Unicode string in python-plplot?
Wojciech Zabolotny
wzab at ipebio15.ise.pw.edu.pl
Tue Sep 21 09:11:47 EDT 2004
On Mon, 20 Sep 2004, Fernando Perez wrote:
>
> You might want to try matplotlib. I don't specifically know about its unicode
> support, but I'd guess it's either there or can be added if you point out
> problems. Matplotlib is very actively developed, and has a really clean
> interface which allows interactive and off-line plots, as well as being
> available as a widget you can embed in your own Tk, GTK or WX apps.
>
Thanks a lot, it really was a good solution.
I had some problems with unicode in matplotlib as well, however
the essential was to select the proper unicode capable backend (GTK)
BEFORE i imported the matlab emulation.
Below is my code snippet (based on the matplotlib tutorial example) which
succesfully displays unicode string:
#!/usr/bin/python
# -*- Encoding: iso-8859-2 -*-
import matplotlib
matplotlib.use('GTK')
from matplotlib.matlab import *
from matplotlib.font_manager import *
p = FontProperties()
font = {'fontname' : 'Lucida',
'color' : 'r',
'fontweight' : 'bold',
'fontsize' : 16}
plot([1,2,3])
xlabel(u'natężenie',font)
ylabel(u'napięcie',font)
title(u'Wykres z polskimi literkami ąćęłńóśżź',font)
show()
Thank a lot,
Wojtek Zabolotny
More information about the Python-list
mailing list