8000 Fixed incorrect bbox of eps output when usetex=True · matplotlib/matplotlib@946c5f2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 946c5f2

Browse files
committed
Fixed incorrect bbox of eps output when usetex=True
svn path=/trunk/matplotlib/; revision=7068
1 parent fe8f8c2 commit 946c5f2

File tree

2 files changed

+26
-10
lines changed

2 files changed

+26
-10
lines changed

CHANGELOG

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
======================================================================
22

3+
2009-04-28 Fixed incorrect bbox of eps output when usetex=True. - JJL
4+
35
2009-04-24 Changed use of os.open* to instead use subprocess.Popen.
46
os.popen* are deprecated in 2.6 and are removed in 3.0. - RMM
57

lib/matplotlib/backends/backend_ps.py

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,16 +1096,24 @@ def _print_figure_tex(self, outfile, format, dpi, facecolor, edgecolor,
10961096
isLandscape = True
10971097
width, height = height, width
10981098
bbox = (lly, llx, ury, urx)
1099-
temp_papertype = _get_papertype(width, height)
1100-
if papertype=='auto':
1101-
papertype = temp_papertype
1102-
paperWidth, paperHeight = papersize[temp_papertype]
1099+
1100+
# set the paper size to the figure size if isEPSF. The
1101+
# resulting ps file has the given size with correct bounding
1102+
# box so that there is no need to call 'pstoeps'
1103+
if isEPSF:
1104+
paperWidth, paperHeight = self.figure.get_size_inches()
11031105
else:
1104-
paperWidth, paperHeight = papersize[papertype]
1105-
if (width>paperWidth or height>paperHeight) and isEPSF:
1106+
temp_papertype = _get_papertype(width, height)
1107+
if papertype=='auto':
1108+
papertype = temp_papertype
11061109
paperWidth, paperHeight = papersize[temp_papertype]
1107-
verbose.report('Your figure is too big to fit on %s paper. %s \
1108-
paper will be used to prevent clipping.'%(papertype, temp_papertype), 'helpful')
1110+
else:
1111+
paperWidth, paperHeight = papersize[papertype]
1112+
if (width>paperWidth or height>paperHeight) and isEPSF:
1113+
paperWidth, paperHeight = papersize[temp_papertype]
1114+
verbose.report('Your figure is too big to fit on %s paper. %s \
1115+
paper will be used to prevent clipping.'%(papertype, temp_papertype), 'helpful')
1116+
11091117

11101118
texmanager = renderer.get_texmanager()
11111119
font_preamble = texmanager.get_font_preamble()
@@ -1247,8 +1255,14 @@ def gs_distill(tmpfile, eps=False, ptype='letter', bbox=None):
12471255
os.remove(outfile)
12481256
os.remove(tmpfile)
12491257
shutil.move(psfile, tmpfile)
1250-
if eps:
1251-
pstoeps(tmpfile, bbox)
1258+
1259+
1260+
1261+
# Since the the paper size is set to the figure size for eps
1262+
# output (in '_print_figure_tex'), pstoeps call is not required.
1263+
1264+
#if eps:
1265+
# pstoeps(tmpfile, bbox)
12521266

12531267

12541268
def xpdf_distill(tmpfile, eps=False, ptype='letter', bbox=None):

0 commit comments

Comments
 (0)
0