Closed
Description
When I export a pdf with savefig I have errors in the greek letters, but only in the pdf the png export is fine. I use the option "usetex=True" and the package "mathptmx".
import matplotlib.pyplot as plt
from matplotlib import rc
import matplotlib
rc('text', usetex=True)
rc('text.latex',preamble= [
r"\usepackage{mathptmx}",
])
x = range(10)
plt.figure()
plt.plot(x, label = r'$\varphi$')
plt.legend()
plt.xlabel('abcdefgh')
name = matplotlib.__version__
plt.savefig('mpl_'+name+'.pdf')
plt.savefig('mpl_'+name+'.png')
plt.show()
With the provided code you will get a png and a pdf file. In the pdf file the \varphi symbol in the legend is only a long line. With version 2.2.4 and 1.5.3 this happens. With Version 1.4.3 the pdf and the png is fine.
Matplotlib version
- Operating system: MacOS 10.12.6
- Matplotlib version: 2.2.4, 1.5.3 and 1.4.3 tested
- Matplotlib backend: MacOSX
- Python version: 2.7.17
All instalations done via macports.
Attached the output files:
Version 1.4.3
mpl_1.4.3.pdf
Version 1.5.3
mpl_1.5.3.pdf
Version 2.2.4
mpl_2.2.4.pdf
Screenshot of error in pdf