Setting font type using rcParams does not work under Python 3.* #1978

Merged
merged 1 commit into from May 6, 2013

Conversation

Projects
None yet
3 participants
Owner

mdboom commented May 6, 2013

The following code:

import matplotlib as mpl
import matplotlib.pyplot as plt
# if I omit the next line, the plot saves without error, but with outlined fonts
mpl.rcParams['pdf.fonttype'] = 42        #set Truetype fonts for Adobe
plt.plot(range(5),range(5),'r-')
plt.ylabel('y')
plt.xlabel('x')
plt.title('title')
plt.savefig("myfig.pdf")

runs fine in Python 2.7.3, but causes TypeError: 'str' does not support the buffer interface error in Python 3.3 on OsX and Python 3.2.3 on Linux.

(se also http://stackoverflow.com/questions/16391280/python-3-3-matplotlib-1-2-0-pdf-export-generates-str-does-not-support-the )

Owner

mdboom commented May 6, 2013

Can you confirm the attached patch resolves your issue?

@ghost ghost assigned mdboom May 6, 2013

lahvak commented May 6, 2013

Yes, it seems to work fine on Linux, with Python 3.2.3.

mdboom added a commit that referenced this pull request May 6, 2013

Merge pull request #1978 from mdboom/type42-python3
Setting font type using rcParams does not work under Python 3.*

@mdboom mdboom merged commit 0c3768e into matplotlib:v1.2.x May 6, 2013

1 check passed

default The Travis build passed
Details

It also works on OSX with Python 3.3.0. Thanks!

@mdboom mdboom deleted the mdboom:type42-python3 branch Aug 7, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment