William Stein wrote:

> 
> That's one of those quick hackish design decisions that comes back to
> haunt us over the years...  can one just query matplotlib for a range
> that contains all the elements in the plot?


Indeed!

Some discussion:

For tick labels and other things that extend beyond the axes, you can 
shrink the entire plot to fit inside of the figure.  I wrote some code 
to do that, but it is not finished yet.  I posted a short example to the 
matplotlib mailing list to include in their documentation (based on a 
more limited example already in their FAQ):

http://www.nabble.com/Automatically-make-room-for-tick-labels-FAQ-entry-td25251691.html

That code takes care of tick labels extending out, but could be expanded 
to look at all interesting graphical objects in a plot.  This doesn't 
address the clipping at axes boundaries, though (see below).

Another thing to deal with is not clipping the circles at the axes 
boundaries (plot a graph and do frame=True and axes_pad=0 in show to see 
what I mean, or try plotting a bunch of points with axes_pad=0).  There 
is a bug in our current version of matplotlib (fixed in matplotlib svn) 
where the clipping parameter is ignored for scatter plots (which is what 
our vertices are), so we can't turn off clipping right now.  See 
http://www.mail-archive.com/matplotlib-de...@lists.sourceforge.net/msg05486.html
 
for the relevant discussion.

I think you're mentioning something different, though---calculate a 
(tight) bounding box around the figures and resize the axes coordinates 
based on that.  It is slightly nontrivial, since the scatter plot sizes 
are specified in points, so we don't know the data coordinate sizes of 
the vertices until we actually draw them (and thus have the dpi). 
However, there is a way to have a callback adjust things as we draw the 
figure (see paragraph (1) above for an example).

Thanks,

Jason


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to