Revision: 7068
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7068&view=rev
Author:   leejjoon
Date:     2009-04-28 19:48:18 +0000 (Tue, 28 Apr 2009)

Log Message:
-----------
Fixed incorrect bbox of eps output when usetex=True

Modified Paths:
--------------
    trunk/matplotlib/CHANGELOG
    trunk/matplotlib/lib/matplotlib/backends/backend_ps.py

Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG  2009-04-27 23:30:20 UTC (rev 7067)
+++ trunk/matplotlib/CHANGELOG  2009-04-28 19:48:18 UTC (rev 7068)
@@ -1,5 +1,7 @@
 ======================================================================
 
+2009-04-28 Fixed incorrect bbox of eps output when usetex=True. - JJL
+
 2009-04-24 Changed use of os.open* to instead use subprocess.Popen.
            os.popen* are deprecated in 2.6 and are removed in 3.0. - RMM
 

Modified: trunk/matplotlib/lib/matplotlib/backends/backend_ps.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py      2009-04-27 
23:30:20 UTC (rev 7067)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_ps.py      2009-04-28 
19:48:18 UTC (rev 7068)
@@ -1096,17 +1096,25 @@
             isLandscape = True
             width, height = height, width
             bbox = (lly, llx, ury, urx)
-        temp_papertype = _get_papertype(width, height)
-        if papertype=='auto':
-            papertype = temp_papertype
-            paperWidth, paperHeight = papersize[temp_papertype]
+
+        # set the paper size to the figure size if isEPSF. The
+        # resulting ps file has the given size with correct bounding
+        # box so that there is no need to call 'pstoeps'
+        if isEPSF: 
+            paperWidth, paperHeight = self.figure.get_size_inches()
         else:
-            paperWidth, paperHeight = papersize[papertype]
-            if (width>paperWidth or height>paperHeight) and isEPSF:
+            temp_papertype = _get_papertype(width, height)
+            if papertype=='auto':
+                papertype = temp_papertype
                 paperWidth, paperHeight = papersize[temp_papertype]
-                verbose.report('Your figure is too big to fit on %s paper. %s \
-paper will be used to prevent clipping.'%(papertype, temp_papertype), 
'helpful')
+            else:
+                paperWidth, paperHeight = papersize[papertype]
+                if (width>paperWidth or height>paperHeight) and isEPSF:
+                    paperWidth, paperHeight = papersize[temp_papertype]
+                    verbose.report('Your figure is too big to fit on %s paper. 
%s \
+    paper will be used to prevent clipping.'%(papertype, temp_papertype), 
'helpful')
 
+
         texmanager = renderer.get_texmanager()
         font_preamble = texmanager.get_font_preamble()
         custom_preamble = texmanager.get_custom_preamble()
@@ -1247,10 +1255,16 @@
     os.remove(outfile)
     os.remove(tmpfile)
     shutil.move(psfile, tmpfile)
-    if eps:
-        pstoeps(tmpfile, bbox)
 
 
+
+    # Since the the paper size is set to the figure size for eps
+    # output (in '_print_figure_tex'), pstoeps call is not required.
+
+    #if eps:
+    #    pstoeps(tmpfile, bbox)
+
+
 def xpdf_distill(tmpfile, eps=False, ptype='letter', bbox=None):
     """
     Use ghostscript's ps2pdf and xpdf's/poppler's pdftops to distill a file.


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to