> From: Daniel Mader [mailto:danielstefanma...@googlemail.com] 
> 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.


------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to