The only solution I could find was to update matplotlib from 1.2.1 to 1.3.1. Now it works without problems.
matplotlib fails to output EPS figure with usetex = True
-
29-08-2022 - |
Question
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)?
La solution
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow