pygal
pygal copied to clipboard
Box plot ignores range
For whatever reason, using pygal.Box ignores the range=[]. For example:
import pygal
boxPlot = pygal.Box(range=(8000, 10000), box_mode="stdev")
boxPlot.title = "Test"
boxPlot.add('Dataset A', [8938, 8687, 8869, 8736, 8657, 8608])
boxPlot.add('Dataset B', [9422, 9557, 9718, 9617, 9368, 9532])
boxPlot.render_to_file('test.svg')
This graph starts at 0 which is not useful for examining standard deviation.
As a test, I did the following:
boxPlot = pygal.Box(range=(70, 100), box_mode="stdev")
boxPlot.title = "Test"
boxPlot.add("A", [80, 90, 86, 81, 96])
boxPlot.add("B", [82, 93, 88, 89, 97])
boxPlot.render_to_file('test.svg')
This time it went from 0-100. Dropping range=(70, 100) causes the y labels to only go up to 90. Is this the wrong option?
e: I did try using both a tuple and a list for range with the same result.
Aha!
I found that if I do boxPlot.zero = 80, that does what I want. Seems weird that range wouldn't work as expected but oh well. Thanks!