8000 Error with greek letters in pdf export when using usetex=True and mathptmx · Issue #16087 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
Error with greek letters in pdf export when using usetex=True and mathptmx #16087
Closed
@markushartmann

Description

@markushartmann

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
mpl_1 4 3
Version 1.5.3
mpl_1.5.3.pdf
mpl_1 5 3
Version 2.2.4
mpl_2.2.4.pdf
mpl_2 2 4

Screenshot of error in pdf

Bildschirmfoto 2020-01-04 um 02 43 20

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0