Hi,

i have nearly the same problem. I need to make plots
in which the text, axea and labels are either in
english, frensh, german, spanish or italian. I use
wxPython and in the main-program it woks with the
languages, but the plots have these little squares in
the text if there has to be a umlaut or special
chracter. The unicode demo works as long as the plot
is not embedded in wxPython. With wxPython only
"self.axes.set_ylabel( unicode('Andr\xc3\xa9 was
here!', 'utf-8') )" is working. The other texts have
some weird characters in it. Here is the code to check
yourself:

# -*- coding: utf_8 -*-

from wxPython.wx import *
import gettext
from pylab import *
matplotlib.use('WXAgg')
from matplotlib.backends.backend_wxagg import
FigureCanvasWxAgg as FigureCanvas
from matplotlib.figure import Figure

class GraphFrame(wxFrame):
    def __init__(self, parent, ID, title):
        wxFrame.__init__(self, parent, ID, title,
size=(650,450))

        self.figure = Figure()

        self.axes = self.figure.add_subplot(111)

        self.axes.plot([1,2,4])
        self.axes.set_title( unicode('Développés et
fabriqués', 'latin-1') )
        self.axes.set_xlabel( unicode("réactivité nous
permettent d'être sélectionnés et adoptés", 'latin-1')
)
        self.axes.set_ylabel( unicode('Andr\xc3\xa9
was here!', 'utf-8') )
        self.axes.text( 0.5, 2.5, unicode('Institut
für Festkörperphysik', 'latin-1'), rotation=45)
        self.axes.text( 1, 1.5, u'AVA (check
kerning)')  

        self.canvas = FigureCanvas(self, -1,
self.figure)
        self.sizer = wxBoxSizer(wxVERTICAL)
        self.sizer.Add(self.canvas, 1, wxLEFT | wxTOP
| wxGROW)
        self.SetSizer(self.sizer)
        self.Fit()
        
class MyApp(wxApp):
    def OnInit(self):

        # Install gettext. Once this is done, all
strings enclosed in "_()" will automatically be
translated.
        gettext.install('MyApp', './locale',
unicode=True)

        # detect the user's default language setting
        loc = wxLocale
        userLang = loc.GetSystemLanguage()

        frame = GraphFrame(None, -1, _("Graph Frame"))
        self.SetTopWindow(frame)
        frame.CentreOnScreen()
        frame.Show(True)
        return True

def main():
    app = MyApp(0)
    app.MainLoop()

if __name__ == '__main__':
    main()


The problem is that i do not know all texts to be
shown, as the name of the user should be written as
title.

I am using Windows XP, Python 2.3, wxPython 2.6.1.0
and Matplotlib 0.85

Thanks

   Till Wagner



--- John Hunter <[EMAIL PROTECTED]>
schrieb:

> >>>>> "marek" == marek  <[EMAIL PROTECTED]> writes:
> 
>     marek> I need to make plots in which the axes
> and text labels
>     marek> display in either English, Spanish, or
> Portuguese.
> 
> Does the unicode demo work for you?
> 
>
http://matplotlib.sourceforge.net/examples/unicode_demo.py
> 
> JDH
> 
>
-------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get
> the chance to share your
> opinions on IT & business topics through brief
> surveys -- and earn cash
>
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
>
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 


--
"Since man's natural instincts lead him to sin, all men are sinners;
and all sinners go to hell.  If everyone goes to hell, then you will
meet all your friends there. Heaven must be populated with some
rather strange creatures if all they lived for was to go to a place
where they can stump harps for eternity."- Anton Szandor LaVey
------------------------------------------------------------------------
Till Wagner <[EMAIL PROTECTED]>


                
___________________________________________________________ 
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to