Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e84e171

Browse files
committed
fixed a tex output error problem
svn path=/trunk/matplotlib/; revision=1541
1 parent 1290316 commit e84e171

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

examples/tex_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
title(r"\TeX\ is Number $\displaystyle\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}$!",
2929
fontsize=16, color='r')
3030
grid(True)
31-
#savefig('tex_demo.eps')
31+
savefig('/tmp/tex_demo.eps')
3232

3333

3434
show()

lib/matplotlib/backends/backend_ps.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -935,16 +935,17 @@ def print_figure(self, outfile, dpi=72,
935935
# need to make some temporary files so latex can run without
936936
# writing over something important.
937937
m = md5.md5(outfile)
938-
tmpname = os.path.join(TexManager.texcache, m.hexdigest())
939-
os.environ['TEXMFOUTPUT'] = TexManager.texcache
938+
tmpname = m.hexdigest()
940939

941940
epsfile = tmpname + '.eps'
942941
psfile = tmpname + '.ps'
943942
texfile = tmpname + '.tex'
944943
dvifile = tmpname + '.dvi'
945944
latexh = file(texfile, 'w')
946945
fh = file(epsfile, 'w')
947-
else: fh = file(outfile, 'w')
946+
else:
947+
fh = file(outfile, 'w')
948+
948949
isEPSF = ext.lower().startswith('.ep') or rcParams['text.usetex']
949950
needsClose = True
950951
title = outfile
@@ -1100,8 +1101,9 @@ def print_figure(self, outfile, dpi=72,
11001101
verbose.report(''.join(stderr.readlines()), 'helpful')
11011102
shutil.move(epsfile, outfile)
11021103
else: shutil.move(psfile, outfile)
1103-
cleanup = glob.glob(tmpname+'.*')
1104-
for fname in cleanup: os.remove(fname)
1104+
1105+
for fname in glob.glob(tmpname+'.*'):
1106+
os.remove(fname)
11051107

11061108
if rcParams['ps.usedistiller']:
11071109
dpi = rcParams['ps.distiller.res']

0 commit comments

Comments
 (0)