Further to: http://stackoverflow.com/questions/326679/choosing-an-attractive-linear-scale-for-a-graphs-y-axis
And what to do when some of the points are negative?
I believe this part of the question was not answered but it seems I can't comment or extend that question so I've created a new one
Values -100, 0, 100 with 5 ticks:
- lower bound = -100
- upper bound = 100
- range = 100--100 = 200
- tick range = 40
- Divide by 10^2 for 0.4, translates to 0.4, which gives (multiplied by 10^2) 40.
- new lower bound = 40 * round(-100/40) = -80
- new upper bound = 40 * round(1+100/40) = 120
or
- new lower bound = 40 * floor(-100/40) = -120
- new upper bound = 40 * floor(1+100/40) = 120
Now the range has been increased to 240 (an extra tick!), with 5 ticks at 40 each. it will take 6 steps to fill the new range!
Solution?