Sage: Ticket #1431: basic plotting: add support for setting the location and labels of all tick marks on the x and y axes
https://trac.sagemath.org/ticket/1431
<p>
Amazingly some very basic functionality for plotting hasn't yet been implemented! In particular, there is nothing yet for setting the location and labels of all tick marks on the x and y axes. This needs to be implemented.
</p>
en-usSagehttps://trac.sagemath.org/chrome/site/logo_sagemath_trac.png
https://trac.sagemath.org/ticket/1431
Trac 1.1.6wasSun, 09 Dec 2007 02:49:08 GMTcomponent changed
https://trac.sagemath.org/ticket/1431#comment:1
https://trac.sagemath.org/ticket/1431#comment:1
<ul>
<li><strong>component</strong>
changed from <em>algebraic geometry</em> to <em>graphics</em>
</li>
</ul>
TicketkcrismanTue, 15 Sep 2009 17:28:23 GMT
https://trac.sagemath.org/ticket/1431#comment:2
https://trac.sagemath.org/ticket/1431#comment:2
<p>
This should be available now with <a class="closed ticket" href="https://trac.sagemath.org/ticket/5448" title="enhancement: [with patch, positive review] rework save/show in plot, use ... (closed: fixed)">#5448</a>, but this ticket would now be to expose that functionality from matplotlib.
</p>
TicketjasonThu, 12 Nov 2009 00:16:40 GMTattachment set
https://trac.sagemath.org/ticket/1431
https://trac.sagemath.org/ticket/1431
<ul>
<li><strong>attachment</strong>
set to <em>formatter.patch</em>
</li>
</ul>
TicketjasonThu, 12 Nov 2009 00:17:34 GMTstatus changed
https://trac.sagemath.org/ticket/1431#comment:3
https://trac.sagemath.org/ticket/1431#comment:3
<ul>
<li><strong>status</strong>
changed from <em>new</em> to <em>needs_work</em>
</li>
</ul>
<p>
Still needs doctest examples.
</p>
<p>
Example:
</p>
<pre class="wiki">
def multiple_of_pi(n,pos):
m = n*1.0/float(pi)
c=[i for i in convergents(m) if i.denominator()<12]
q=c[-1]
if q.denominator()==1:
if q.numerator()==1:
return r'$\pi$'
elif q.numerator()==-1:
return r'$-\pi$'
else:
return r'$%s\pi$'%q
else:
if q.numerator()==1:
return r'$\frac{\pi}{%s}$'%q.denominator()
elif q.numerator()==-1:
return r'$\frac{-\pi}{%s}$'%q.denominator()
else:
return r'$\frac{%s\pi}{%s}$'%(q.numerator(),q.denominator())
from matplotlib.ticker import MultipleLocator, FuncFormatter
plot(sin(x), (x, -4, 4), tick_locator=MultipleLocator(float(pi/3)), tick_formatter=FuncFormatter(multiple_of_pi))
</pre>
TicketjasonThu, 12 Nov 2009 00:18:05 GMTauthor set
https://trac.sagemath.org/ticket/1431#comment:4
https://trac.sagemath.org/ticket/1431#comment:4
<ul>
<li><strong>author</strong>
set to <em>Jason Grout</em>
</li>
</ul>
TicketkcrismanThu, 12 Nov 2009 03:25:47 GMT
https://trac.sagemath.org/ticket/1431#comment:5
https://trac.sagemath.org/ticket/1431#comment:5
<p>
This looks like a great start. Now we need a wrapper to make creating the formatters and locators easy for the average user. I will try to help with that, and documentation, as I get a chance. Thanks!
</p>
TicketjasonThu, 12 Nov 2009 03:36:05 GMT
https://trac.sagemath.org/ticket/1431#comment:6
https://trac.sagemath.org/ticket/1431#comment:6
<p>
Personally, I think creating formatters and locators *is* easy. Notice what I did to create the locator: <code>MultipleLocator(float(pi/3))</code>. The formatter is slightly harder because it's a harder problem I was trying to solve---given a floating point number, find a nice multiple of pi expression for a label. In general, though, it's easy to just give a list of tick values and strings.
</p>
<p>
What did you have in mind for an easier wrapper?
</p>
TicketjasonThu, 12 Nov 2009 03:45:10 GMT
https://trac.sagemath.org/ticket/1431#comment:7
https://trac.sagemath.org/ticket/1431#comment:7
<p>
A simpler example:
</p>
<pre class="wiki">def multiple_of_pi(n,pos):
m = n*1.0/float(pi)
c=[i for i in convergents(m) if i.denominator()<12]
q=c[-1]
return '$%s$'%latex(q*pi)
from matplotlib.ticker import MultipleLocator, FuncFormatter
plot(sin(x), (x, -4, 4), tick_locator=MultipleLocator(float(pi/4)), tick_formatter=FuncFormatter(multiple_of_pi))
</pre>
TicketjasonThu, 12 Nov 2009 04:13:32 GMT
https://trac.sagemath.org/ticket/1431#comment:8
https://trac.sagemath.org/ticket/1431#comment:8
<p>
See <a class="closed ticket" href="https://trac.sagemath.org/ticket/4529" title="enhancement: Implement plots with logarithmic scale (closed: fixed)">#4529</a> for a related ticket---logarithmic scales.
</p>
TicketjasonThu, 12 Nov 2009 04:14:32 GMT
https://trac.sagemath.org/ticket/1431#comment:9
https://trac.sagemath.org/ticket/1431#comment:9
<p>
One last one that is even simpler:
</p>
<pre class="wiki">def multiple_of_pi(n,pos):
c=[i for i in convergents(n/pi) if i.denominator()<=12]
return '$%s$'%latex(c[-1]*pi)
from matplotlib.ticker import MultipleLocator, FuncFormatter
plot(sin(x), (x, -10, 10), tick_locator=MultipleLocator(float(pi/2)), tick_formatter=FuncFormatter(multiple_of_pi),figsize=[10,4])
</pre>
TicketkcrismanThu, 12 Nov 2009 15:38:16 GMTstatus, author changed; reviewer set
https://trac.sagemath.org/ticket/1431#comment:10
https://trac.sagemath.org/ticket/1431#comment:10
<ul>
<li><strong>status</strong>
changed from <em>needs_work</em> to <em>needs_review</em>
</li>
<li><strong>reviewer</strong>
set to <em>Karl-Dieter Crisman</em>
</li>
<li><strong>author</strong>
changed from <em>Jason Grout</em> to <em>Jason Grout, Karl-Dieter Crisman</em>
</li>
</ul>
<p>
This is what I meant:
</p>
<pre class="wiki">sage: plot(sin(x), (x,0,2*pi), tick_locator=pi/3, tick_formatter='pi')
sage: plot(1.5/(1+e^(-x)), (x,-10,10), tick_locator=[None, 1.5/4]) # shows the inflection point height!
</pre><p>
See soon-to-be-attached patch. Thanks SO much for making this possible - my additions just make it easier for people like me who don't know matplotlib :)
</p>
<p>
Also, positive review to the parts I didn't do.
</p>
TicketkcrismanThu, 12 Nov 2009 15:43:53 GMT
https://trac.sagemath.org/ticket/1431#comment:11
https://trac.sagemath.org/ticket/1431#comment:11
<p>
Perhaps a followup is what sort of object is a Locator? Just a list? I couldn't find this in the built-in documentation for ticker (and wasn't online when I created it). If so, then the documentation should be updated to reflect that; I still think this having the option of just a number is a good one, though I was cludgy in dealing with some of the Errors that might arise.
</p>
TicketkcrismanThu, 12 Nov 2009 15:45:58 GMTattachment set
https://trac.sagemath.org/ticket/1431
https://trac.sagemath.org/ticket/1431
<ul>
<li><strong>attachment</strong>
set to <em>trac_1431.patch</em>
</li>
</ul>
<p>
Based on 4.2
</p>
TicketjasonThu, 12 Nov 2009 17:46:09 GMT
https://trac.sagemath.org/ticket/1431#comment:12
https://trac.sagemath.org/ticket/1431#comment:12
<p>
Two comments:
</p>
<ul><li>tick_formatter should accept rational multiples of *any* symbolic constant. I think the code ought to be generalized before going into Sage. For example, I should have ticks that are rational multiples of e as well.
</li></ul><ul><li>I like the idea of having tick_locator be a number. I think it should be expanded to being a list (if symbolic expressions, then latexing them can give the formatters), or a function.
</li></ul><p>
See <a class="ext-link" href="http://reference.wolfram.com/mathematica/ref/Ticks.html"><span class="icon"></span>http://reference.wolfram.com/mathematica/ref/Ticks.html</a> for the equivalent mathematica feature.
</p>
TicketjasonThu, 12 Nov 2009 17:46:23 GMTstatus changed
https://trac.sagemath.org/ticket/1431#comment:13
https://trac.sagemath.org/ticket/1431#comment:13
<ul>
<li><strong>status</strong>
changed from <em>needs_review</em> to <em>needs_work</em>
</li>
</ul>
TicketjasonThu, 12 Nov 2009 17:46:48 GMT
https://trac.sagemath.org/ticket/1431#comment:14
https://trac.sagemath.org/ticket/1431#comment:14
<p>
I'm putting this as needs_work while we flush out a nice design.
</p>
TicketkcrismanThu, 12 Nov 2009 18:03:08 GMTdescription changed
https://trac.sagemath.org/ticket/1431#comment:15
https://trac.sagemath.org/ticket/1431#comment:15
<ul>
<li><strong>description</strong>
modified (<a href="/ticket/1431?action=diff&version=15">diff</a>)
</li>
</ul>
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/1431#comment:12" title="Comment 12">jason</a>:
</p>
<blockquote class="citation">
<p>
Two comments:
</p>
<ul><li>tick_formatter should accept rational multiples of *any* symbolic constant. I think the code ought to be generalized before going into Sage. For example, I should have ticks that are rational multiples of e as well.
</li></ul><ul><li>I like the idea of having tick_locator be a number. I think it should be expanded to being a list (if symbolic expressions, then latexing them can give the formatters), or a function.
</li></ul></blockquote>
<p>
These make lots of sense. It should be easy to check if the string is in symbolic.constants or something (or even accept those as input), and then of course one would have to check if there was a symbolic expression in the list, and (possibly override) use tick_formatter appropriately. After all, multiple_of_pi could be made generic to multiple_of_symbolic_constant, and then we could make a dummy function to input into <a class="missing wiki">FuncFormatter?</a> or something.
</p>
TicketkcrismanTue, 20 Apr 2010 17:41:34 GMTupstream set
https://trac.sagemath.org/ticket/1431#comment:16
https://trac.sagemath.org/ticket/1431#comment:16
<ul>
<li><strong>upstream</strong>
set to <em>N/A</em>
</li>
</ul>
<p>
Okay, I've finally had time to return to this, and I'm almost done dealing with this. It is actually really cool!
</p>
<p>
Formatting by multiples of constants (or numbers) will be implemented, as well as locating by arbitrary lists. Note that
</p>
<pre class="wiki"> ``LogLocator``
logarithmically ticks from min to max
</pre><p>
could solve our log problems, though I think that would not belong on this ticket (and I think there is one for this).
</p>
TicketkcrismanTue, 20 Apr 2010 19:42:16 GMTattachment set
https://trac.sagemath.org/ticket/1431
https://trac.sagemath.org/ticket/1431
<ul>
<li><strong>attachment</strong>
set to <em>trac_1431-ticks-and-formatting.patch</em>
</li>
</ul>
<p>
Based on 4.3.5, apply only this patch to Sage library
</p>
TicketkcrismanTue, 20 Apr 2010 19:42:26 GMTstatus changed
https://trac.sagemath.org/ticket/1431#comment:17
https://trac.sagemath.org/ticket/1431#comment:17
<ul>
<li><strong>status</strong>
changed from <em>needs_work</em> to <em>needs_review</em>
</li>
</ul>
TicketjasonTue, 20 Apr 2010 20:29:52 GMTowner changed
https://trac.sagemath.org/ticket/1431#comment:18
https://trac.sagemath.org/ticket/1431#comment:18
<ul>
<li><strong>owner</strong>
changed from <em>was</em> to <em>jason</em>
</li>
</ul>
<ol><li>"Private" functions (like the first one) should begin with an underscore
</li><li>plot(2*x+1,(x,0,5),tick_locator=[[0,1,e,pi,sqrt(20)],2],tick_formatter="latex") looks really bad since the minor ticks do not pay attention to the major ticks
</li><li>in general, it looks really weird to have very small latex numbers on one axis while having large non-latex numbers on the other axis. I'm not sure what we can do about this.
</li></ol>
TicketjasonTue, 20 Apr 2010 20:29:59 GMTstatus changed
https://trac.sagemath.org/ticket/1431#comment:19
https://trac.sagemath.org/ticket/1431#comment:19
<ul>
<li><strong>status</strong>
changed from <em>needs_review</em> to <em>needs_work</em>
</li>
</ul>
TicketjasonTue, 20 Apr 2010 20:30:23 GMTowner changed
https://trac.sagemath.org/ticket/1431#comment:20
https://trac.sagemath.org/ticket/1431#comment:20
<ul>
<li><strong>owner</strong>
changed from <em>jason</em> to <em>kcrisman</em>
</li>
</ul>
TicketkcrismanTue, 20 Apr 2010 20:42:00 GMT
https://trac.sagemath.org/ticket/1431#comment:21
https://trac.sagemath.org/ticket/1431#comment:21
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/1431#comment:18" title="Comment 18">jason</a>:
</p>
<blockquote class="citation">
<ol><li>"Private" functions (like the first one) should begin with an underscore
</li></ol></blockquote>
<p>
You mean the multiple one? Ok.
</p>
<blockquote class="citation">
<ol><li>plot(2*x+1,(x,0,5),tick_locator=[[0,1,e,pi,sqrt(20)],2],tick_formatter="latex") looks really bad since the minor ticks do not pay attention to the major ticks
</li></ol></blockquote>
<p>
I totally agree, but I figured it was best to respond to your suggestion first, and then take ideas for how to fix this issue. Any ideas?
</p>
<blockquote class="citation">
<ol><li>in general, it looks really weird to have very small latex numbers on one axis while having large non-latex numbers on the other axis. I'm not sure what we can do about this.
</li></ol></blockquote>
<p>
I see. I don't think this is a problem - we can just make it so that "latex" is applied to both axes, if used. What do you think?
</p>
TicketkcrismanWed, 21 Apr 2010 03:20:42 GMT
https://trac.sagemath.org/ticket/1431#comment:22
https://trac.sagemath.org/ticket/1431#comment:22
<p>
Okay, I've fixed all of these things. Note that Mma only includes major ticks for lists of ticks, so I just went with that (much easier!). The latex thing was annoying - there was a bug in sage.misc.latex.str_function:
</p>
<pre class="wiki">sage: sage.misc.latex.str_function('4')
'4'
sage: sage.misc.latex.str_function('4.0')
'\\texttt{4.0}'
</pre><p>
At least I view this as a bug, and in any case it prevents the latexing from working properly even if the tick_locator had [0,1.0,e] rather than [0,1,e]. Unified patch coming up.
</p>
TicketkcrismanWed, 21 Apr 2010 03:27:48 GMTstatus changed
https://trac.sagemath.org/ticket/1431#comment:23
https://trac.sagemath.org/ticket/1431#comment:23
<ul>
<li><strong>status</strong>
changed from <em>needs_work</em> to <em>needs_review</em>
</li>
</ul>
<p>
Apply only ticks, formatting, and latex patch.
</p>
TicketjasonWed, 21 Apr 2010 03:40:29 GMTstatus changed
https://trac.sagemath.org/ticket/1431#comment:24
https://trac.sagemath.org/ticket/1431#comment:24
<ul>
<li><strong>status</strong>
changed from <em>needs_review</em> to <em>needs_work</em>
</li>
</ul>
<p>
Very nice now! One last thing that I saw: the examples for _multiple_... still have the problem of halfof the ticks being in latex and the other half not. For example, plot(x^2, (x, -2, 2), tick_formatter=pi) has the vertical labels in the standard font and the horizontal labels in tex.
</p>
TicketkcrismanWed, 21 Apr 2010 12:52:27 GMT
https://trac.sagemath.org/ticket/1431#comment:25
https://trac.sagemath.org/ticket/1431#comment:25
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/1431#comment:24" title="Comment 24">jason</a>:
</p>
<blockquote class="citation">
<p>
Very nice now! One last thing that I saw: the examples for _multiple_... still have the problem of halfof the ticks being in latex and the other half not. For example, plot(x^2, (x, -2, 2), tick_formatter=pi) has the vertical labels in the standard font and the horizontal labels in tex.
</p>
</blockquote>
<p>
Hmm, that's true. I don't know - this is more of a design decision than anything. In theory, we could latex ALL our tick labels, but that seems overkill. On the other hand, the solution to this would be kind of cludgy.
</p>
<p>
Also, I was thinking about it this morning and wondered whether it would make sense to have the "tick_locator" keyword be just "ticks" or "tick" instead. Mma using "ticks", and "tick_locator" is a little longish ("tick_formatter" makes sense, though).
</p>
<p>
Let me know if you have any ideas.
</p>
TicketwasTue, 18 May 2010 05:28:46 GMT
https://trac.sagemath.org/ticket/1431#comment:26
https://trac.sagemath.org/ticket/1431#comment:26
<p>
Thanks for all the work on this ticket. I'm helping my wife with a final project for an environmental science class (involving measuring "smog"), and not having tick control is devastating. Finally, for the first time, I personally really need this capability :-)
</p>
<p>
Another killer is not have a legend. Is that also easy to add via something similar? (Probably.)
</p>
TicketjasonTue, 18 May 2010 05:31:36 GMT
https://trac.sagemath.org/ticket/1431#comment:27
https://trac.sagemath.org/ticket/1431#comment:27
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/1431#comment:26" title="Comment 26">was</a>:
</p>
<blockquote class="citation">
<p>
Another killer is not have a legend. Is that also easy to add via something similar? (Probably.)
</p>
</blockquote>
<p>
See <a class="closed ticket" href="https://trac.sagemath.org/ticket/4342" title="enhancement: Add legends to plot.py (closed: fixed)">#4342</a>
</p>
TicketjasonTue, 18 May 2010 05:33:25 GMT
https://trac.sagemath.org/ticket/1431#comment:28
https://trac.sagemath.org/ticket/1431#comment:28
<p>
Of course, you can also always use straight matplotlib to do these things right now.
</p>
TicketwasTue, 18 May 2010 05:53:30 GMT
https://trac.sagemath.org/ticket/1431#comment:29
https://trac.sagemath.org/ticket/1431#comment:29
<p>
And it turned out that this patch 100% totally worked to solve my problem. Yes!
</p>
<blockquote>
<p>
<a class="ext-link" href="http://tutorial.sagenb.org/home/pub/19/"><span class="icon"></span>http://tutorial.sagenb.org/home/pub/19/</a>
</p>
</blockquote>
<p>
Of course, it will be nice when the capabilities are doctested.
</p>
<p>
Regarding using "straight matplotlib", that would be a bit annoying, since all my plot commands are in Sage, so I have to get at the secret underlying matplotlib fig/canvas, right? Or rewrite all my code to use pylab directly. I don't want to do that "on principle".
</p>
TicketjasonTue, 18 May 2010 06:48:19 GMT
https://trac.sagemath.org/ticket/1431#comment:30
https://trac.sagemath.org/ticket/1431#comment:30
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/1431#comment:29" title="Comment 29">was</a>:
</p>
<blockquote class="citation">
<p>
Regarding using "straight matplotlib", that would be a bit annoying, since all my plot commands are in Sage, so I have to get at the secret underlying matplotlib fig/canvas, right?
</p>
</blockquote>
<p>
Well, it's not so secret, though, as it is exposed in a public function:
</p>
<p>
p=plot(x<sup>2,(x,-3,4))
figure=p.matplotlib()
from matplotlib.backends.backend_agg import <a class="missing wiki">FigureCanvasAgg?</a>
figure.set_canvas(<a class="missing wiki">FigureCanvasAgg?</a>(figure))
figure.savefig('test.png')
</sup></p>
<p>
(the last three lines are a bit esoteric, but they are fairly straightforward matplotlib...)
</p>
TicketkcrismanTue, 18 May 2010 16:28:18 GMT
https://trac.sagemath.org/ticket/1431#comment:31
https://trac.sagemath.org/ticket/1431#comment:31
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/1431#comment:29" title="Comment 29">was</a>:
</p>
<blockquote class="citation">
<p>
And it turned out that this patch 100% totally worked to solve my problem. Yes!
</p>
<blockquote>
<p>
<a class="ext-link" href="http://tutorial.sagenb.org/home/pub/19/"><span class="icon"></span>http://tutorial.sagenb.org/home/pub/19/</a>
</p>
</blockquote>
</blockquote>
<p>
Sweet! Looks great.
</p>
<blockquote class="citation">
<p>
Of course, it will be nice when the capabilities are doctested.
</p>
</blockquote>
<p>
Okay, that and figuring out what to do with the Latex situation are all this ticket needs, then. I can't work on this until after the first PREP workshop, but after that it's very high on my list.
</p>
TicketjasonTue, 25 May 2010 15:33:09 GMT
https://trac.sagemath.org/ticket/1431#comment:32
https://trac.sagemath.org/ticket/1431#comment:32
<p>
From private email, in response to kcrisman's comment above:
</p>
<blockquote class="citation">
<p>
Hmm, that's true. I don't know - this is more of a design decision
than anything. In theory, we could latex ALL our tick labels, but that
seems overkill. On the other hand, the solution to this would be kind
of cludgy.
</p>
<p>
Also, I was thinking about it this morning and wondered whether it
would make sense to have the "tick_locator" keyword be just "ticks" or
"tick" instead. Mma using "ticks", and "tick_locator" is a little
longish ("tick_formatter" makes sense, though).
</p>
<p>
Let me know if you have any ideas.
</p>
</blockquote>
<p>
+1 to "ticks"
</p>
<p>
I'm not sure what to do about the latex issue. I suppose the real problem here is that matplotlib does not use compatible fonts for $1$ and just straight 1. That's a bummer. Still, in the common case (i.e., people didn't specify formatters), I think we should make it all latex or all not latex. plot(sin(x), (x,0,pi), tick_formatter=pi) is likely to be a very common case, and we shouldn't have "ugly" output for it. It looks like it might be as easy as changing the line:
</p>
<pre class="wiki"> 1818 if y_formatter is None:
1819 y_formatter = OldScalarFormatter()
</pre><p>
to
</p>
<pre class="wiki">if y_formatter is None:
y_formatter = copy(x_formatter) # maybe copy isn't needed
</pre><p>
We could then also delete the if statement above dealing with setting both formatters to "latex" if tick_formatter="latex".
</p>
<p>
The one problem with this is that plot(..., ticks=pi) would change both the x and the y axis. Maybe we could special-case that situation.
</p>
TicketkcrismanTue, 25 May 2010 18:17:47 GMT
https://trac.sagemath.org/ticket/1431#comment:33
https://trac.sagemath.org/ticket/1431#comment:33
<blockquote class="citation">
<blockquote class="citation">
<p>
Also, I was thinking about it this morning and wondered whether it
would make sense to have the "tick_locator" keyword be just "ticks" or
"tick" instead. Mma using "ticks", and "tick_locator" is a little
longish ("tick_formatter" makes sense, though).
</p>
</blockquote>
<p>
+1 to "ticks"
</p>
</blockquote>
<p>
Ok, done.
</p>
<blockquote class="citation">
<p>
I'm not sure what to do about the latex issue. I suppose the real problem here is that matplotlib does not use compatible fonts for $1$ and just straight 1. That's a bummer. Still, in the common case (i.e., people didn't specify formatters), I think we should make it all latex or all not latex. plot(sin(x), (x,0,pi), tick_formatter=pi) is likely to be a very common case, and we shouldn't have "ugly" output for it. It looks like it might be as easy as changing the line:
</p>
<pre class="wiki"> 1818 if y_formatter is None:
1819 y_formatter = OldScalarFormatter()
</pre><p>
to
</p>
<pre class="wiki">if y_formatter is None:
y_formatter = copy(x_formatter) # maybe copy isn't needed
</pre><p>
We could then also delete the if statement above dealing with setting both formatters to "latex" if tick_formatter="latex".
</p>
<p>
The one problem with this is that plot(..., ticks=pi) would change both the x and the y axis. Maybe we could special-case that situation.
</p>
</blockquote>
<p>
If you note, the documentation is already quite explicit that you should not do that example in 'real life' :-) though I'll make it even more explicit. Luckily that example is also in an underscore function.
</p>
<p>
I think a better solution is that if y_formatter is None and x_formatter was in SR, then we should do y_formatter='latex'. I propose to do this via
</p>
<pre class="wiki"> from sage.symbolic.ring import SR
if not isinstance(tick_formatter, (list, tuple)):
if tick_formatter == "latex" or tick_formatter in SR:
tick_formatter = (tick_formatter, "latex")
else:
tick_formatter = (tick_formatter, None)
</pre><p>
I also will check for the much rarer case of plotting arcsin, so to speak. Patch coming up.
</p>
TicketkcrismanTue, 25 May 2010 18:46:09 GMTattachment set
https://trac.sagemath.org/ticket/1431
https://trac.sagemath.org/ticket/1431
<ul>
<li><strong>attachment</strong>
set to <em>trac_1431-ticks-and-formatting-and-latex.patch</em>
</li>
</ul>
<p>
Based on 4.3.5, apply only this patch to Sage library
</p>
TicketkcrismanTue, 25 May 2010 18:46:48 GMTstatus changed
https://trac.sagemath.org/ticket/1431#comment:34
https://trac.sagemath.org/ticket/1431#comment:34
<ul>
<li><strong>status</strong>
changed from <em>needs_work</em> to <em>needs_review</em>
</li>
</ul>
<p>
Needs review. Notice that for some reason it kept the old message - but this latest one is based on 4.4.2, no worries :-)
</p>
TicketjasonFri, 03 Sep 2010 22:06:49 GMTstatus changed
https://trac.sagemath.org/ticket/1431#comment:35
https://trac.sagemath.org/ticket/1431#comment:35
<ul>
<li><strong>status</strong>
changed from <em>needs_review</em> to <em>positive_review</em>
</li>
</ul>
<p>
Looks great, applies to 4.5.2, and doctests pass in changed files. Great job!
</p>
TicketmpatelWed, 15 Sep 2010 10:40:29 GMTstatus changed; resolution, merged set
https://trac.sagemath.org/ticket/1431#comment:36
https://trac.sagemath.org/ticket/1431#comment:36
<ul>
<li><strong>status</strong>
changed from <em>positive_review</em> to <em>closed</em>
</li>
<li><strong>resolution</strong>
set to <em>fixed</em>
</li>
<li><strong>merged</strong>
set to <em>sage-4.6.alpha1</em>
</li>
</ul>
Ticket