Thanks Stan, you're 100% right! Usually I load a set of rcParams with
another font and that's why I don't have that problem:

## PNG output:
pylab.rcParams['text.usetex'] = False
## schöner sans-serif Font *ohne* LaTeX: 'stixsans'
pylab.rcParams['mathtext.fontset'] = 'stixsans'
## LaTeX-PDF output:
pylab.rcParams['text.usetex'] = True
pylab.rcParams['text.latex.unicode'] = True
pylab.rcParams['text.latex.preamble'] = [
    '\usepackage{lmodern}',
    '\usepackage[T1]{fontenc}',
    '\usepackage{sfmath}',
    '\usepackage{gensymb}',
    '\usepackage{amsmath}',
]

Thanks a lot for clarification!

2011/6/9 Stan West <stan.w...@nrl.navy.mil>:
>> 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