wireservice / leather

Python charting for 80% of humans.
https://leather.readthedocs.io
MIT License
329 stars 30 forks source link

Automatically generate human readable scale endpoints + tick sizes #23

Closed onyxfish closed 8 years ago

onyxfish commented 8 years ago

Some ideas: http://stackoverflow.com/questions/361681/algorithm-for-nice-grid-line-intervals-on-a-graph More: http://stackoverflow.com/questions/8506881/nice-label-algorithm-for-charts-with-minimum-ticks A Tableau paper w/ code: http://www.justintalbot.com/research/axis-labeling/ Blog post: http://austinclemens.com/blog/2016/01/09/an-algorithm-for-creating-a-graphs-axes/

pygal: https://github.com/Kozea/pygal/blob/master/pygal/util.py#L149 matplotlib: https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/ticker.py#L1577 d3: https://github.com/d3/d3-scale/blob/master/src/linear.js#L18 R graphics... I think: https://github.com/wch/r-source/blob/trunk/src/library/graphics/R/axis.R#L67 ggplot2: https://github.com/hadley/ggplot2/blob/master/R/scale-.r#L175

onyxfish commented 8 years ago

Working implementation of Tableau extension and original Heckbert: http://toyplot.readthedocs.io/en/stable/_modules/toyplot/locator.html

onyxfish commented 8 years ago

Implemented the method suggested by Clemens and it seems to work well. I'm certain there are bugs, but closing out and will open new tickets for those.