Changes between Initial Version and Version 21 of Ticket #4529


Ignore:
Timestamp:
05/19/12 13:12:51 (9 years ago)
Author:
ppurka
Comment:

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.

Todo:

  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)
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()

Legend:

Unmodified
Added
Removed
Modified
  • 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.
     2
     3Apply the following patches in the specified order. `SAGE_ROOT` is the directory where the sage installation is present.
     4{{{
     5cd SAGE_ROOT/devel/sage
     6../../sage -hg qimport -P http://trac.sagemath.org/sage_trac/raw-attachment/ticket/12974/trac_12974-fix_graphics_attributes_and_reorder_args.patch
     7../../sage -hg qimport -P http://trac.sagemath.org/sage_trac/raw-attachment/ticket/12974/trac_12974-refactor_and_whitespace_cleanups.patch
     8../../sage -hg qimport -P http://trac.sagemath.org/sage_trac/raw-attachment/ticket/4529/trac_4529-add_logscale_to_Graphics.patch
     9../../sage -b
     10}}}
     11
     12----
     13'''OLD DISCUSSION BELOW :)'''
     14
    115Currently plot() has no option to use logarithmic scales.
    216
     
    2741
    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
     43