From: BL <bra...@gm...> - 2008-01-21 10:59:31
|
Hi, I would like to use non ascii characters in title and label but with my current intallation it does not work properly. There's no warning or error messages when I set a title with some non ascii characters (I use iso-88599-1 characters, like =E9 or =E0), but I get a emp= ty square instead of theses characters in the figure. I'm using matplotlib-0.90.1. Is there anything to configure to handle non ascii characters ? Regards, --=20 BL |
From: Michael D. <md...@st...> - 2008-01-21 14:19:10
|
This probably depends on the backend you are using. Which backend and on which platform are you having trouble with? 0.90.1 had a number of Unicode and non-ascii problems that 0.91.2 resolves. You may want to try that. Failing that, can you attach a small script that exhibits the problem? There may be all kinds of things going wrong, from the encoding of the source file, to an incorrect font etc. and an example would help us narrow it down. Cheers, Mike BL wrote: > Hi, > > I would like to use non ascii characters in title and label but with my > current intallation it does not work properly. > There's no warning or error messages when I set a title with some non > ascii characters (I use iso-88599-1 characters, like é or à), but I get > a empty square instead of theses characters in the figure. > > I'm using matplotlib-0.90.1. > Is there anything to configure to handle non ascii characters ? > > Regards, > > -- > BL > > > > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > > > ------------------------------------------------------------------------ > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA |
From: BL <bra...@gm...> - 2008-01-21 18:40:16
Attachments:
test_mpl.py
|
I'm using a basic Debian Etch distribution. I've attached a very simple file showing the problem. On my computer, neither the title, nor the legend are displayed correctly, and I've got square instead of each non ascii characters. The attached script gives me the following informations : matplotlib : 0.90.1 backend : TkAgg encoding : UTF-8 I will try to install a SVN version of matplotlib and see if this works better. |
From: Michael D. <md...@st...> - 2008-01-21 18:51:02
|
To use non-ascii characters, you need prefix the string literal with a 'u'. For example: u"This is a Unicode string" Alternatively, you can write out an 8-bit string and then explicitly decode it into Unicode: unicode("This is UTF-8", "utf-8") Replacing the r's with u's in the strings in your example solves the problem for me on 0.91.2. (I wasn't able to test 0.90.1 -- that still may have internal problems handling Unicode strings in some backends.) Cheers, Mike BL wrote: > I'm using a basic Debian Etch distribution. > I've attached a very simple file showing the problem. On my computer, > neither the title, nor the legend are displayed correctly, and I've got > square instead of each non ascii characters. > > The attached script gives me the following informations : > > matplotlib : 0.90.1 > backend : TkAgg > encoding : UTF-8 > > I will try to install a SVN version of matplotlib and see if this works > better. > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > > > ------------------------------------------------------------------------ > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA |
From: BL <bra...@gm...> - 2008-01-21 20:05:17
|
> To use non-ascii characters, you need prefix the string literal with a > 'u'. For example: I thought that the u"string" notation was only needed when characters had to be handled with their utf-8 code Replacing the r's with u's in the strings in your example solves the > problem for me on 0.91.2. (I wasn't able to test 0.90.1 -- that still > may have internal problems handling Unicode strings in some backends.) This works fine for me with the SVN version (matplotlib : 0.98pre) but not with matplotlib 0.90.1 Thanks |