#4529: Implement plots with logarithmic scale
-----------------------------------------+----------------------------------
       Reporter:  ronanpaixao            |         Owner:  ronanpaixao          
           Type:  enhancement            |        Status:  needs_work           
       Priority:  major                  |     Milestone:  sage-5.1             
      Component:  graphics               |    Resolution:                       
       Keywords:  plot log scale         |   Work issues:  convenience functions
Report Upstream:  N/A                    |     Reviewers:  Karl-Dieter Crisman  
        Authors:  Punarbasu Purkayastha  |     Merged in:                       
   Dependencies:  #12974                 |      Stopgaps:                       
-----------------------------------------+----------------------------------

Comment (by ppurka):

 Replying to [comment:45 kcrisman]:
 > Sorry for the delay - I only scheduled a couple hours of work this
 evening.  Tomorrow I will have more time.

 No problems. It is better to have a good implementation than to hurry
 through a bad one.

 > Hey, I just had an idea.  Maybe this ticket should be ''only'' about the
 ticket description, and then another ticket for adding the "shortcut"
 commands like `plot_loglog` or whatever.  In which case the current
 patches might be enough!  (After much testing, of course.)  What do you
 think?

 Actually, there is zero change to be done to the code in `plot` or
 `list_plot`, except to add some examples. The only change that the
 additional  patch will do is make very thin (one-liners) wrappers which
 defines the `plot_*` and `list_plot_*` wrappers and pass the correct scale
 option to `plot` and `list_plot`. The current consensus from the poll
 seems to favor this syntax. In view of this, the patch
 [attachment:trac_4529-add_docs_eg_to_some_user_facing_functions.patch]
 requires only a renaming of the functions, and some extra examples.

 > * We'll eventually want to add some examples (or replace some of these)
 with the `plot(...,scale='loglog')` format ones.  And definitely to add
 some to the file `plot.py`, since that is where a lot of people will look
 first for how to get this.  '''But''' that can wait until the end, I'll be
 happy to do that in a reviewer patch.

 We can add exactly similar examples to `plot()` and `list_plot()`.
 Currently, since the function is `Graphics.show()`, I decided to write it
 as `show(scale=...)` instead of `plot(scale=...)` since the former is more
 pertinent.

 > * Catching this thing about the flipped `xmin/xmax` and friends is just
 a bonus - again, great catch and solution.
 > * As to the optional patch, I will think about this some more tomorrow.
 I do note that things still "work".  For the example you removed `G`, the
 example you removed did in fact work, for instance.

 Yes I am aware that the examples I provided work. But most of the examples
 in the docs of those functions (arc, disk, contour_plot, etc) ''do not''
 work out of the box, and we get the "too few ticks" error.

 > I'm not sure whether having minor ticks should count as "having two
 ticks", especially in the relatively obscure-looking log plot situation.
 I'm not even sure why
 > {{{
 > sage: G.show(scale=('loglog', 2))
 > }}}
 >   works, since there is only one tick on the left!

 Yes. That's why I said that the tick checking function is not robust and I
 also don't know how to make it robust.

 > * Along those lines, your example (changed)
 > {{{
 > sage: p = list_plot(range(1, 10), plotjoined=True)
 > sage: p.show(scale='loglog',base=2)
 > }}}
 >   doesn't show any minor ticks.  Is that just how `LogLocator` works, or
 is there something wrong?

 The minor ticks are generated by passing in multiples of 1/base to the
 subs parameter of LogLocator. So, for base 10, you will have ticks at say,
 `0.1*10^-1, 0.2*10^-1, ..., 0.9*10^-1, 10^-1`. This is a typical way how
 log plots are drawn in all programs (`pyplot.loglog()`, matlab,
 mathematica, etc). For `base=2` you can have only one tick `1/2*2^i` but
 this is a major tick at `2^(i-1)`. So, you will always see only one major
 tick and no minor ticks.

 > Obviously at this point we are getting close to nitpicking.  I'll try
 more tomorrow.

 Thanks a lot for the feedback. I am sure I have missed something, so I
 look forward to it. :)

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4529#comment:46>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to