Oops, forget the patch! Now it is attached.

On Thu, Oct 18, 2007 at 04:09:04PM -0400, Joel B. Mohler wrote:
> 
> A couple of days ago I wrote to sage-support complaining about margins on 
> plots 
> -- I think they are too big.  Ironically, it seems that vanilla matplotlib is 
> even worse for this in some respects, but sage does a couple of funny things 
> that I'd like a plotting guru to look at.  It seems there is a couple of 
> rather 
> arbitrary adjustments to min/max parameters.  I think that each one of these 
> adjustments should be reconsidered.  I attached a patch file which fixes my 
> most 
> immediate gripes -- I don't necessarily mean it as a patch to go upstream 
> yet, 
> but to generate discussion with the relevant person (Alex Clemesha?) to come 
> up 
> with a correct fix.
> 
> (Warning: Slight rant ahead) I agree that the results might be pleasing to 
> the 
> eye when you are just throwing up a quick graph on screen, but I abhor 
> arbitrary 
> adjustments when I'm trying to make publication quality .eps files.  For 
> myself, 
> the publication quality graphics is the dominant use of a CAS plotting 
> ability.  
> Therefore, I think this needs to be very well supported mode.  In this case, 
> you 
> are probably using latex and latex makes it's own margin around a figure.  To 
> make an extra margin messes with the all-knowing-wisdom of latex.  I'm 
> probably 
> preaching to the choir in this paragraph, but I've been seriously aggravated 
> at 
> every graphics engine I've used on similar points to these.  I'm hoping sage 
> will be my panacea -- and it's looking likely!
> 
> --
> Joel
> 
> 
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

diff -r 9241a4ebc628 sage/plot/plot.py
--- a/sage/plot/plot.py Mon Oct 15 23:04:04 2007 -0700
+++ b/sage/plot/plot.py Thu Oct 18 15:48:28 2007 -0400
@@ -681,10 +681,10 @@ class Graphics(SageObject):
             ymax = 2*y
             ymin = 0
 
-        xmin -= 0.1*(xmax-xmin)
-        xmax += 0.1*(xmax-xmin)
-        ymin -= 0.1*(ymax-ymin)
-        ymax += 0.1*(ymax-ymin)
+        #xmin -= 0.1*(xmax-xmin)
+        #xmax += 0.1*(xmax-xmin)
+        #ymin -= 0.1*(ymax-ymin)
+        #ymax += 0.1*(ymax-ymin)
 
         return xmin,xmax,ymin,ymax
 
@@ -733,7 +733,8 @@ class Graphics(SageObject):
 
         #The line below takes away the excessive whitespace around
         #images.  ('figsize' and  'dpi' still work as expected):
-        figure.subplots_adjust(left=0.04, bottom=0.04, right=0.96, top=0.96)
+        #figure.subplots_adjust(left=0.04, bottom=0.04, right=0.96, top=0.96)
+        figure.subplots_adjust(left=0, bottom=0, right=1, top=1)
         
         #the incoming subplot instance
         subplot = sub
@@ -775,8 +776,10 @@ class Graphics(SageObject):
         if not (contour or plotfield or matrixplot): #the plot is a 'regular' 
plot 
             if frame: #add the frame axes 
                 xmin,xmax,ymin,ymax = self._prepare_axes(xmin, xmax, ymin, 
ymax)
-                axmin, axmax = xmin - 0.04*abs(xmax - xmin), xmax + 
0.04*abs(xmax - xmin)
-                aymin, aymax = ymin - 0.04*abs(ymax - ymin), ymax + 
0.04*abs(ymax - ymin)
+                #axmin, axmax = xmin - 0.04*abs(xmax - xmin), xmax + 
0.04*abs(xmax - xmin)
+                #aymin, aymax = ymin - 0.04*abs(ymax - ymin), ymax + 
0.04*abs(ymax - ymin)
+                axmin, axmax = xmin, xmax
+                aymin, aymax = ymin, ymax
                 subplot.set_xlim([axmin, axmax])
                 subplot.set_ylim([aymin, aymax])
                 #add a frame to the plot and possibly 'axes_with_no_ticks'

Reply via email to