Localization in mpl

Hi matplotlib-users,

I have an application which I am currently translating to other
languages including Chinese. I was wondering what recommendations you
have for internationalization with regards to matplotlib. Using the
default font it seems like Chinese characters are not showing up on
the plots. I tried running this file:

# -*- coding: utf-8 -*-
from matplotlib import pyplot as p
p.plot([1,2,4])
wind = u'\u98ce'
p.title(wind)
p.savefig('test.png')

But there is just a box instead of the proper character on the plot.
Any ideas what went wrong? Do I have to use a special font?

I also tried using TeX following the example here:

http://matplotlib.sourceforge.net/examples/pylab_examples/tex_unicode_demo.html

but it did not work when I put in Chinese symbols.

Any ideas?

Best regards,
Jesper

Jesper Larsen wrote:

Hi matplotlib-users,

I have an application which I am currently translating to other
languages including Chinese. I was wondering what recommendations you
have for internationalization with regards to matplotlib. Using the
default font it seems like Chinese characters are not showing up on
the plots. I tried running this file:

# -*- coding: utf-8 -*-
from matplotlib import pyplot as p
p.plot([1,2,4])
wind = u'\u98ce'
p.title(wind)
p.savefig('test.png')

Try include the font in your matplotlibrc file. For example, I was able
to show the "wind" "风" by adding 'AR PL SungtiL GB' (no quotes) to the
font.sans-serif property line.

Regards,
ST

···

--