eps with usetex=False broken icw Ghostscript 9.07?

sorry...forgot to tag the subject as [matplotlib-devel]

···

On 4 March 2013 13:35, David Verelst <david.verelst@...149...> 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.

sorry...forgot to tag the subject as [matplotlib-devel]

The server does it for you.

···

On Mon, Mar 4, 2013 at 6:44 AM, David Verelst <david.verelst@...149...> wrote:

On 4 March 2013 13:35, David Verelst <david.verelst@...149...> 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 rc
parameter text.usetex is set. This works currently on the agg and ps
backends, and requires that you have tex and the other dependencies
described at http://matplotlib.sf.net/matplotlib.texmanager.html
properly installed on your system. The first time you run a script
you will see a lot of output from tex and associated tools. The next
time, the run may be silent, as a lot of the information is cached in
~/.tex.cache

"""
from matplotlib import rc
from numpy import arange, cos, pi
from 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)+2
plot(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.

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

--
Damon McDougall
http://www.damon-is-a-geek.com
Institute for Computational Engineering Sciences
201 E. 24th St.
Stop C0200
The University of Texas at Austin
Austin, TX 78712-1229