I added a patch to Graphics
class which introduces log plots. Some salient points
- I had to "disable" some tick formatting for log plots because matplotlib wasn't behaving well with the formatting that is done in
Graphics().maptplotlib()
(ex. the error in comment:11, out of memory error, etc)
- The patch in this ticket relies on the patches in #12974 which is mostly a cleanup of the
Graphics
class.
- In trying to implement my own class, I started to look at each of the matplotlib functions more carefully, and found out the reason(s) why setting the scale wasn't working (see point 1.). The result is that I could implement log scale right inside
Graphics
by carefully weeding out the corner cases. I hope I got all the corner cases.
Todo:
- A patch to
plot()
and other functions will take more time to implement. :(
- Probably need to make sure that user does not specify tick formatters and locators which don't behave well with log plots.
- Feedback is welcome! I need to know if I missed something.
Example code:
p = plot(exp, 1, 10)
p.set_scale('loglog')
p.show()
xd=range(-5,5); yd=[10**_ for _ in xd]; p=list_plot(zip(xd, yd),plotjoined=True)
p.set_yscale('log', 2) # Set only y-axis to log and with base of log being 2.
p.show()