#1431: basic plotting: add support for setting the location and labels of all
tick
marks on the x and y axes
------------------------------------------------+---------------------------
Reporter: was | Owner: kcrisman
Type: enhancement | Status: needs_work
Priority: major | Milestone: sage-4.4.3
Component: graphics | Keywords:
Author: Jason Grout, Karl-Dieter Crisman | Upstream: N/A
Reviewer: Karl-Dieter Crisman | Merged:
Work_issues: |
------------------------------------------------+---------------------------
Comment(by kcrisman):
> > 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).
> >
> +1 to "ticks"
Ok, done.
> 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:
>
> {{{
> 1818 if y_formatter is None:
> 1819 y_formatter = OldScalarFormatter()
> }}}
> to
> {{{
> if y_formatter is None:
> y_formatter = copy(x_formatter) # maybe copy isn't needed
> }}}
> We could then also delete the if statement above dealing with setting
both formatters to "latex" if tick_formatter="latex".
>
> 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.
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.
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
{{{
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)
}}}
I also will check for the much rarer case of plotting arcsin, so to speak.
Patch coming up.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/1431#comment:33>
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.