1

I am trying to output (savefig) matplotlib figures as EPS; however, it seems there is a conflict when using the LaTeX rendering AND saving EPS figures. For example, the following code produces a good EPS figure:

import matplotlib.pyplot as plt import numpy as np plt.figure() plt.plot(np.random.rand(100)) plt.savefig('plot.eps') 

whereas this code produces an EPS figure that can not be viewed; my document viewer (Ubuntu's Evince) continuously says "Loading..."

import matplotlib.pyplot as plt import numpy as np plt.rc('text', usetex = True) plt.figure() plt.plot(np.random.rand(100)) plt.savefig('plot.eps') 

Is there a known issue when combining these two options? Is there any kind of work around (aside from saving as PDF or saving as PDF then converting to EPS)?

7
  • will it open with inkscape? Commented Dec 5, 2013 at 21:29
  • @tcaswell No, Inkscape failed to open it, returning the error: "ps2pdf failed" Commented Dec 5, 2013 at 21:32
  • what version of mpl and latex? Commented Dec 5, 2013 at 21:38
  • and can you put the eps someplace? Commented Dec 5, 2013 at 21:38
  • @tcaswell mpl: 1.2.1, texlive: 20130772-1, and eps: dropbox.com/s/sld8jw5n1uepngb/plot.eps Commented Dec 5, 2013 at 21:39

1 Answer 1

2

The only solution I could find was to update matplotlib from 1.2.1 to 1.3.1. Now it works without problems.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.