python - Greek letters are printed bold in matplotlib latex output -
i'm using latex output in matplotlib print greek symbols axis , legends. (serif) text printed in normal font weight, special characters printed in bold. in particular, mean mu micro, (non-greek) symbol angstrom. however, other greek symbols omega printed normally. made little example demonstrate:
#!/usr/bin/python # -*- coding: utf-8 -*- import matplotlib mpl import matplotlib.pyplot plt mpl.rcparams['text.usetex'] = true mpl.rcparams['text.latex.unicode'] = true mpl.rcparams['font.family'] = 'serif' mpl.rcparams['text.latex.preamble'] = [ r"\usepackage{textgreek}", r"\usepackage{siunitx}"] fig = plt.figure() plt.plot([1, 2, 4], [0, 9, 7]) plt.xlabel( r"\si{\micro\metre} " + r"\si{\omega\metre} " + r"\si{\nano\metre} " + r"\si{\angstrom} " + r"\si{\micro\metre}\textmu") plt.show() fig.savefig('test.png') fig.savefig('test.pdf') i have issue on live output, vector output , image output. what's confusing me, used script month on outdate ubuntu machine on work, python 3.3 installed. tried run script on personal arch machine , issues.
it seems problem fonts have installed, in case fix problem specifying font want use following commands:
mpl.rcparams['font.serif'] = 'times' a list of fonts available can found here: http://matplotlib.org/users/customizing.html
Comments
Post a Comment