From: Stan W. <sta...@nr...> - 2011-06-09 17:38:32
|
> From: Daniel Mader [mailto:dan...@go...] > Sent: Thursday, June 09, 2011 11:59 > > Hi, > > I just noticed this doesn't work here, too, as I expected :( > > with u'äöüß°€' I can print the string, but the labels are still broken > in the plot: > > # -*- coding: utf-8 -*- > > import matplotlib.pyplot as plt > plt.plot([1,2,3,4]) > > xlabel = r'öäüß°€' > plt.xlabel(xlabel) > plt.show() > plt.savefig('asdf') > > Would be interesting to know what's going on... What font was used for the label? >>> plt.gca().xaxis.label.get_fontname() 'Bitstream Vera Sans' The usual default above has a limited character set. You can select a font that has the characters you want using plt.xlabel(u'äöüß°€', fontdict={'family': 'Cambria'}) for a given bit of text or plt.rc('font', family='Cambria') to make it the default. |