[Matplotlib-users] em-dash not correctly displayed in saved pdf when using tex
Chao-Chin Yang
chaochinyang at icloud.com
Mon Dec 28 04:26:40 EST 2015
Hi, I am having issues with producing an em-dash in pdf when using tex. A sample script is as below:
#!/usr/bin/env python3
import matplotlib.pyplot as plt
import math
import numpy as np
x = np.linspace(0, 2 * math.pi)
y = np.cos(x)
plt.plot(x, y)
plt.suptitle(r"abc --- def")
plt.savefig("test.pdf")
plt.show()
I have customized rc parameters:
backend = “TkAgg”
font.family = “serif”
text.usetex = True
image.cmap = “CMRmap"
The plot rendered on screen looks fine. However, there are some weird characters showing up right before the em-dash in the saved pdf, as attached here.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.pdf
Type: application/pdf
Size: 148357 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20151228/6a962bb6/attachment-0001.pdf>
-------------- next part --------------
I am using Linux Mint 17.3, and uname -a gives
Linux Eridanus 3.19.0-32-generic #37~14.04.1-Ubuntu SMP Thu Oct 22 09:41:40 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
I am using python 3.4.3 + matplotlib 1.3.1, the latter of which is kind of old, but still remains the latest in the Ubuntu LTS repository. On the other had, I have installed the texlive-full package, which should include all the tex related packages. My dvipng is 1.14, and my ghostscript is 9.10. I have also tried different backends like Agg or PDF, but it makes no difference.
I have tried googling around for similar issues, but had no luck.
It would be very much appreciated If anyone had some idea how this comes about.
Sincerely,
Chao-Chin
More information about the Matplotlib-users
mailing list