#5448: [with patch, needs work] rework save/show in plot, use Matplotlib's axes
code, upgrade matplotlib
-------------------------+--------------------------------------------------
Reporter: mhansen | Owner: mhansen
Type: enhancement | Status: assigned
Priority: major | Milestone: sage-4.1.2
Component: graphics | Keywords:
Reviewer: | Author:
Merged: |
-------------------------+--------------------------------------------------
Comment(by jason):
Replying to [comment:26 kcrisman]:
> Comments on the latest iteration:
>
> I like the new look of vector/slope fields, actually - clear, because
there are internal axes now!
>
> Here are some small technical details I do not like, which cause it to
still "need work".
>
> 1. plot(x**2,-1,1) is unacceptable. No one will believe that even
though the origin is in the graph, the axes don't cross! Instead they
will assume that the origin is not in the graph. Presumably there is a
way to have the algorithm do this, though, on an adhoc basis.
Yes, it seems that numerical error is our enemy here:
{{{
sage: ax=plot(x**2,-1,1).matplotlib().axes[0]
sage: ax.get_ylim()
(2.2226365446612245e-06, 1.0)
}}}
I modified the code so that if 0 is within 1% of the range, but not
included in the range, then we enlarge the range to include 0. We could
change this 1% parameter, or make it user-settable.
This is fixed in the patch I'm posting up in a second.
>
> 2. plot(x**3,-1,1,axes_labels=['x','y']) shows that we should wait with
this patch until there is a good way to move the axes - this is too
confusing. Try replacing 'y' with 'zany' and it's just silly. Matplotlib
style axis labels only work with frames.
>
I've fixed this---well, except for one exceptional case. I'm waiting to
hear back on the matplotlib mailing list (it might be a bug in
matplotlib). I'll post up a patch in a second.
> 3. there needs to be a slightly better algorithm for deciding what
direction the ticks face. E.g. look at plot(x**3,-1,0).
Agreed. Do you have a suggestion? Maybe if the axis is in the middle of
the picture, put ticks on both sides, and if it is on the side of the
picture, put ticks facing inwards?
>
> 4. compare plot(x**4,-1,54) and plot(x**4,-1,55). Notice how once the
scientific notation comes into play, matplotlib doesn't label correctly.
As in the top is cut off? Is that what you are talking about?
We can change how the labels are printed pretty easily. What do you
suggest?
>
> That's all I found for now :) But it's nice to have some time to try to
get this good. Assuming we actually want to do so, that is - is it more
effort than its worth? Maybe the matplotlib upgrade could be a separate
ticket, because that is certainly worthwhile and presumably doesn't cause
any problems.
This is great. I think we are close enough to being done with this (or at
least, close enough to a sage-devel discussion) that it's not worth trying
to package 0.99.0 separately. Most of the reason why 0.99.0 is worth it
is for these changes, I think.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/5448#comment:27>
Sage <http://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
-~----------~----~----~----~------~----~------~--~---