#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):

 Thanks for looking at this!  I haven't had time to come back to it yet
 (our semester started...)

 Replying to [comment:10 kcrisman]:
 > 1. When using pointsize, matplotlib axes (or the way in which they are
 used) has some whitespace cutting off points, for example when pointsize
 is large (20 worked for me, but unfortunately I can't cut and paste and
 example here).

 On the one hand, I can turn off clipping.  However, that tends to make
 really ugly plots when you have frame axes (since then the dots go outside
 of the frames).  On the other hand, we can automatically enlarge the plot
 axes (so that if you request -3..3, it might actually cover -3.5..3.5).
 This could be frustrating, but is sort of what happens now.  I guess you
 have to make a choice between things extending beyond your plot (no
 clipping) or extending your plot.  For right now, I was hoping that people
 would just make their ranges a bit bigger by hand.



 >
 > 2. I'm not sure I like the non-intersecting axes on regular plots.  That
 is weird, especially in graphs like the plot of x squared type things.
 plot(x**2,0,1) looks great; plot(x**2,-1,1) looks... interesting.

 Yeah, it's a bit different, but after playing with it for a while, I liked
 it.  At a glance, it oriented me to what I was looking at and how it was
 compared to the infinite plane.  This is definitely something that should
 go up for a vote.

 Also, I'd like to add an option for a custom crossing point.  That would
 be another 5 lines of code, maybe.



 >
 > 3. For some reasons, showing some plots yields the #5956 ValueError of
 "ValueError: width and height must each be below 32768" which apparently
 comes from matplotlib/backends/backend_agg.py, the RendererAgg (whatever
 that is).  I should point out these are plots which worked before.
 Apparently it has something to do with adding axes_labels, because without
 them, this problem does not appear.  Did something get a LOT bigger on the
 axis labels?


 For right now, I automatically expand things to not clip axes labels.
 There might be a bug in that.  Can you post an example?



 >
 > 4. The two zeros where axes intersect is distracting.  I'm not sure what
 else to say about that, other than that it's true.  This is especially
 true when the graph gets close to the origin.  Of course, the reason for
 labeling it has been discussed elsewhere - it just may have to get
 "smart".  Maybe when the origin IS the intersection point of the axes (as
 one might expect), this could be tacitly omitted?

 It would be easy to omit one or both of these zeros in these cases.


 >
 > 5. For some reason William's example in some talk where he does a little
 eye candy with image manipulation (e.g., "compressed using x eigenvalues")
 doesn't work right; only the second matrix_plot works properly, the other
 one does not.  So something with the new axes and frame isn't working
 right.

 Okay, I'll try to look at this.



 >
 > 6. Ironically, switching slope fields to normal (not frame) axes is
 worse, because it's hard to see the numbers with any reasonably density of
 the points for the slopes.


 and your proposed fix is...?


 >
 > 7. This is just a question: is it possible to get custom labeling for
 axis numbering now in matrix plots?  E.g., (!) if I am taking just the
 4th-6th powers of some numbers and plotting them in a grid, can I label
 those columns as 4-6?  I don't know if mpl has this; the axes_grid thing
 on the website looked conceivably related, maybe even good for matrix_plot
 or multiple graphics.


 Totally easy.  You have the full power of matplotlib at your command.  You
 just do something like:

 p=plot(m).matplotlib()
 # p is now a matplotlib figure object

 Now just do custom axes locators for axes in p, like in
 http://matplotlib.sourceforge.net/examples/pylab_examples/custom_ticker1.html

 When you are done, just do:

 p.save_fig('test.png') # or something like this

 or (with another change that should be coming soon, now that I understand
 matplotlib a lot better):

 Graphics(p) # This is now a sage Graphics object...

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/5448#comment:11>
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to