From: David V. <dav...@gm...> - 2013-03-04 12:45:09
|
sorry...forgot to tag the subject as [matplotlib-devel] On 4 March 2013 13:35, David Verelst <dav...@gm...> wrote: > Hi, > > I am running Arch Linux, Matplotlib 1.2, Python 2.7, and today I realized > that generating *.eps figures when matplotlib is using the latex output > rc('text', usetex=True) results in a corrupted eps figure in combination > with Ghostscript 9.07. The png variant of the same figure works fine, eps > works fine if usetex=False. Everything works fine when I downgrade back to > Ghostscript 9.06. > > Is this related to this? > https://github.com/matplotlib/matplotlib/issues/1693 > https://github.com/matplotlib/matplotlib/pull/1694 > If it is, I guess the problem is already solved. Haven't tested that yet > (need to build matplitlib from git first...) > > I have no idea if this is Arch Linux packaging, Ghostscript or Matplotlib > issue...hence this email. > > Regards, > David > > > An example, from: http://matplotlib.org/users/usetex.html > > #!/usr/bin/env python"""You can use TeX to render all of your matplotlib text if the rcparameter text.usetex is set. This works currently on the agg and psbackends, and requires that you have tex and the other dependenciesdescribed at http://matplotlib.sf.net/matplotlib.texmanager.htmlproperly installed on your system. The first time you run a scriptyou will see a lot of output from tex and associated tools. The nexttime, the run may be silent, as a lot of the information is cached in~/.tex.cache > """from matplotlib import rcfrom numpy import arange, cos, pifrom matplotlib.pyplot import figure, axes, plot, xlabel, ylabel, title, \ > grid, savefig, show > > rc('text', usetex=True)rc('font', family='serif')figure(1, figsize=(6,4))ax = axes([0.1, 0.1, 0.8, 0.7])t = arange(0.0, 1.0+0.01, 0.01)s = cos(2*2*pi*t)+2plot(t, s) > xlabel(r'\textbf{time (s)}')ylabel(r'\textit{voltage (mV)}',fontsize=16)title(r"\TeX\ is Number $\displaystyle\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}$!", > fontsize=16, color='r')grid(True)savefig('tex_demo.eps')savefig('tex_demo.png') > show() > > > When converting the eps figure with imagemagick (just to check the file), > the following error is given: > $ convert Desktop/tex_demo.eps ddd.eps > Error: /dictstackunderflow in --end-- > Operand stack: > > Execution stack: > %interp_exit .runexec2 --nostringval-- --nostringval-- > --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- > --nostringval-- false 1 %stopped_push 1900 1 3 %oparray_pop > 1899 1 3 %oparray_pop --nostringval-- 1883 1 3 > %oparray_pop 1771 1 3 %oparray_pop --nostringval-- > %errorexec_pop .runexec2 --nostringval-- --nostringval-- > --nostringval-- 2 %stopped_push --nostringval-- > Dictionary stack: > --dict:1169/1684(ro)(G)-- --dict:0/20(G)-- --dict:82/200(L)-- > Current allocation mode is local > Last OS error: No such file or directory > Current file position is 102614 > GPL Ghostscript 9.07: Unrecoverable error, exit code 1 > Error: /dictstackunderflow in --end-- > Operand stack: > > Execution stack: > %interp_exit .runexec2 --nostringval-- --nostringval-- > --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- > --nostringval-- false 1 %stopped_push 1900 1 3 %oparray_pop > 1899 1 3 %oparray_pop --nostringval-- 1883 1 3 > %oparray_pop 1771 1 3 %oparray_pop --nostringval-- > %errorexec_pop .runexec2 --nostringval-- --nostringval-- > --nostringval-- 2 %stopped_push --nostringval-- > Dictionary stack: > --dict:1169/1684(ro)(G)-- --dict:0/20(G)-- --dict:82/200(L)-- > Current allocation mode is local > Last OS error: No such file or directory > Current file position is 102614 > GPL Ghostscript 9.07: Unrecoverable error, exit code 1 > convert: Postscript delegate failed `Desktop/tex_demo.eps': No such file > or directory @ error/ps.c/ReadPSImage/836. > convert: no images defined `ddd.eps' @ > error/convert.c/ConvertImageCommand/3068. > > |