Changes between Initial Version and Version 21 of Ticket #4529

05/19/12 13:12:51 (10 years ago)

I added a patch to Graphics class which introduces log plots. Some salient points

  1. 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)
  2. The patch in this ticket relies on the patches in #12974 which is mostly a cleanup of the Graphics class.
  3. 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.


  1. A patch to plot() and other functions will take more time to implement. :(
  2. Probably need to make sure that user does not specify tick formatters and locators which don't behave well with log plots.
  3. Feedback is welcome! I need to know if I missed something.

Example code:

p = plot(exp, 1, 10)
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.


  • Ticket #4529

    • Property Status changed from new to needs_work
    • Property Milestone changed from sage-wishlist to sage-3.2.1
    • Property Dependencies changed from to 12974
    • Property Report Upstream changed from to N/A
    • Property Owner changed from somebody to ronanpaixao
  • Ticket #4529 – Description

    initial v21  
     1Attached is a patch which introduces log scale to `Graphics()` class.
     3Apply the following patches in the specified order. `SAGE_ROOT` is the directory where the sage installation is present.
     5cd SAGE_ROOT/devel/sage
     6../../sage -hg qimport -P
     7../../sage -hg qimport -P
     8../../sage -hg qimport -P
     9../../sage -b
     13'''OLD DISCUSSION BELOW :)'''
    115Currently plot() has no option to use logarithmic scales.
    2842From what I noticed, Mathematica implements the separate functions way, but it may be better to fix the issue in plot() itself and if the other functions are wanted, just make it so that they call plot() with the correct arguments