I want to automatically set the vertical scale on a line graph, based on the maximum value in a dataset. So far I came up with this method:
if 0 < max and max <= 250:
ymax = 250
elif 250 < max and max <= 500:
ymax = 500
elif 500 < max and max <= 750:
ymax = 750
elif 750 < max and max <= 1000:
ymax = 1000
Could anyone recommend a more concise approach?
another not so intuitive implementation
and here is the result
[(0, 0), (50, 250), (100, 250), (150, 250), (200, 250), (250, 250), (300, 500), (350, 500), (400, 500), (450, 500), (500, 500), (550, 750), (600, 750), (650, 750), (700, 750), (750, 750), (800, 1000), (850, 1000), (900, 1000), (950, 1000), (1000, 1000), (1050, 1250), (1100, 1250), (1150, 1250)]And yet another implementation
Add one more to the bouquet