-----Original Message-----
From: Michael Droettboom [mailto:mdroe@…86…]
Sent: Tuesday, November 25, 2008 1:06 PM
To: Drain, Theodore R
Cc: matplotlib-users@lists.sourceforge.net
Subject: Re: [Matplotlib-users] polar
Drain, Theodore R wrote:
> Michael,
> I think the issue is that there is no Unicode in the script that was
attached - it's just a simple polar call so the user isn't really
Unicode".
>
Polar plots always use Unicode by default for the degree sign. It
would
be crazy to try to do those things without Unicode. The problem at
hand
here is only when usetex is on and text.latex.unicode is False. I
think
it's perhaps time to adjust the default on the latter to True to avoid
this issue -- but someone more familiar with usetex should comment on
that.
> I think Unicode is starting to creep into the source in various
places
Use of Unicode characters in output has existed for some time. There
is, however, no Unicode in the source files (something we've had
transiently but have addressed), because it does cause a problem with
some editors. I think that's a reasonable style guideline, but
avoiding
Unicode in the output is not. I personally put in a lot of work to
support Unicode in all the backends -- it allows the output to be
richer
and more like traditional typesetting rather than being stuck with the
limitations imposed by 7-bit ASCII, which is the only reasonable
alternative.
> - we just had a user point out that negative numbers are using a
normal negative sign ('-1.2') anymore but some kind of Unicode dash
that's a lot bigger than the normal one. I wonder if this could be
related...
>
Yes, it's another instance of the same thing. (Though if usetex is
True, we don't have this specific problem, since TeX has always done
this substitution for us and matplotlib doesn't do the hyphen/minus
correction.)
> (If it matters, most of our users would rather have just the regular
negative sign and not embedded Unicode in the axis labels - it looks
wrong to them and makes doing any kind of processing of axis labels
more difficult).
>
I think that's a matter user preference, and perhaps should be exposed
as an rcParam. Personally, it's always bothers me to see TeX-typeset
papers where the math expressions have proper minus signs, but the
plots
use a hyphen. But maybe I'm too bothered by these things...
As for processing the axis labels, there are far hairier things (such
as
scientific notation) that make processing axis labels as strings in the
general case difficult. If you need their positions as numeric values,
one can simply use get_majorticklocs() and get an array of floats.
Cheers,
Mike
> Ted
>
>
>> -----Original Message-----
>> From: Michael Droettboom [mailto:mdroe@…86…]
>> Sent: Tuesday, November 25, 2008 12:25 PM
>> To: Nils Wagner
>> Cc: matplotlib-users@lists.sourceforge.net
>> Subject: Re: [Matplotlib-users] polar
>>
>> It says:
>>
>> "You are using unicode and latex, but have not enabled the
matplotlib
>> 'text.latex.unicode' rcParam."
>>
>> Does setting text.latex.unicode to True resolve the issue?
>>
>> Maybe that message should be made more prominent -- it currently is
>> only
>> displayed when verbose is turned on, but it really is an exception.
>> Maybe that message should be raised, rather than reraising the
original
>> one there.
>>
>> Mike
>>
>> Nils Wagner wrote:
>>
>>> Hi all,
>>>
>>> If I run the attached example I get
>>>
>>> python -i test_polar.py --verbose-helpful
>>> $HOME=/home/nwagner
>>> matplotlib data path /usr/lib/python2.4/site-
packages/matplotlib/mpl-
>>>
>> data
>>
>>> loaded rc file /home/nwagner/matplotlibrc
>>> matplotlib version 0.98.3
>>> verbose.level helpful
>>> interactive is False
>>> units is False
>>> platform is linux2
>>> CONFIGDIR=/home/nwagner/.matplotlib
>>> Using fontManager instance from
>>>
>> /home/nwagner/.matplotlib/fontList.cache
>>
>>> backend WXAgg version 2.5.3.1
>>> findfont: Matching
>>> :family=sans-
>>>
>>
serif:style=normal:variant=normal:weight=normal:stretch=normal:size=med
>> ium
>>
>>> to Bitstream Vera Sans
>>> (/usr/lib/python2.4/site-packages/matplotlib/mpl-
>>>
>> data/fonts/ttf/Vera.ttf)
>>
>>> with score of 1.000000
>>> Found dvipng version 1.5
>>> You are using unicode and latex, but have not enabled the
matplotlib
>>> 'text.latex.unicode' rcParam.
>>> Traceback (most recent call last):
>>> File
>>> "/usr/lib/python2.4/site-
packages/matplotlib/backends/backend_wx.py",
>>> line 1121, in _onPaint
>>> self.draw(drawDC=drawDC)
>>> File
>>> "/usr/lib/python2.4/site-
>>>
>> packages/matplotlib/backends/backend_wxagg.py",
>>
>>> line 60, in draw
>>> FigureCanvasAgg.draw(self)
>>> File
>>> "/usr/lib/python2.4/site-
>>>
>> packages/matplotlib/backends/backend_agg.py",
>>
>>> line 283, in draw
>>> self.figure.draw(self.renderer)
>>> File "/usr/lib/python2.4/site-packages/matplotlib/figure.py",
line
>>> 767, in draw
>>> for a in self.axes: a.draw(renderer)
>>> File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line
>>> 1591, in draw
>>> a.draw(renderer)
>>> File "/usr/lib/python2.4/site-packages/matplotlib/axis.py", line
>>> 710, in draw
>>> tick.draw(renderer)
>>> File "/usr/lib/python2.4/site-packages/matplotlib/axis.py", line
>>> 193, in draw
>>> self.label1.draw(renderer)
>>> File "/usr/lib/python2.4/site-packages/matplotlib/text.py", line
>>> 448, in draw
>>> bbox, info = self._get_layout(renderer)
>>> File "/usr/lib/python2.4/site-packages/matplotlib/text.py", line
>>> 251, in _get_layout
>>> w, h, d = renderer.get_text_width_height_descent(
>>> File
>>> "/usr/lib/python2.4/site-
>>>
>> packages/matplotlib/backends/backend_agg.py",
>>
>>> line 150, in get_text_width_height_descent
>>> Z = texmanager.get_grey(s, size, self.dpi)
>>> File "/usr/lib/python2.4/site-packages/matplotlib/texmanager.py",
>>> line 383, in get_grey
>>> pngfile = self.make_png(tex, fontsize, dpi)
>>> File "/usr/lib/python2.4/site-packages/matplotlib/texmanager.py",
>>> line 312, in make_png
>>> dvifile = self.make_dvi(tex, fontsize)
>>> File "/usr/lib/python2.4/site-packages/matplotlib/texmanager.py",
>>> line 275, in make_dvi
>>> texfile = self.make_tex(tex, fontsize)
>>> File "/usr/lib/python2.4/site-packages/matplotlib/texmanager.py",
>>> line 254, in make_tex
>>> fh.write(s)
>>> UnicodeEncodeError: 'ascii' codec can't encode character u'\xb0' in
>>> position 300: ordinal not in range(128)
>>> You are using unicode and latex, but have not enabled the
matplotlib
>>> 'text.latex.unicode' rcParam.
>>> Traceback (most recent call last):
>>> File
>>> "/usr/lib/python2.4/site-
packages/matplotlib/backends/backend_wx.py",
>>> line 1121, in _onPaint
>>> self.draw(drawDC=drawDC)
>>> File
>>> "/usr/lib/python2.4/site-
>>>
>> packages/matplotlib/backends/backend_wxagg.py",
>>
>>> line 60, in draw
>>> FigureCanvasAgg.draw(self)
>>> File
>>> "/usr/lib/python2.4/site-
>>>
>> packages/matplotlib/backends/backend_agg.py",
>>
>>> line 283, in draw
>>> self.figure.draw(self.renderer)
>>> File "/usr/lib/python2.4/site-packages/matplotlib/figure.py",
line
>>> 767, in draw
>>> for a in self.axes: a.draw(renderer)
>>> File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line
>>> 1591, in draw
>>> a.draw(renderer)
>>> File "/usr/lib/python2.4/site-packages/matplotlib/axis.py", line
>>> 710, in draw
>>> tick.draw(renderer)
>>> File "/usr/lib/python2.4/site-packages/matplotlib/axis.py", line
>>> 193, in draw
>>> self.label1.draw(renderer)
>>> File "/usr/lib/python2.4/site-packages/matplotlib/text.py", line
>>> 448, in draw
>>> bbox, info = self._get_layout(renderer)
>>> File "/usr/lib/python2.4/site-packages/matplotlib/text.py", line
>>> 251, in _get_layout
>>> w, h, d = renderer.get_text_width_height_descent(
>>> File
>>> "/usr/lib/python2.4/site-
>>>
>> packages/matplotlib/backends/backend_agg.py",
>>
>>> line 150, in get_text_width_height_descent
>>> Z = texmanager.get_grey(s, size, self.dpi)
>>> File "/usr/lib/python2.4/site-packages/matplotlib/texmanager.py",
>>> line 383, in get_grey
>>> pngfile = self.make_png(tex, fontsize, dpi)
>>> File "/usr/lib/python2.4/site-packages/matplotlib/texmanager.py",
>>> line 312, in make_png
>>> dvifile = self.make_dvi(tex, fontsize)
>>> File "/usr/lib/python2.4/site-packages/matplotlib/texmanager.py",
>>> line 275, in make_dvi
>>> texfile = self.make_tex(tex, fontsize)
>>> File "/usr/lib/python2.4/site-packages/matplotlib/texmanager.py",
>>> line 254, in make_tex
>>> fh.write(s)
>>> UnicodeEncodeError: 'ascii' codec can't encode character u'\xb0' in
>>> position 300: ordinal not in range(128)
>>>
>>> Any idea ?
>>>
>>> Nils
>>>
>>> -------------------------------------------------------------------
--
>>>
>> ---
>>
>>> -------------------------------------------------------------------
--
>>>
>> ----
>>
>>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>>>
>> challenge
>>
>>> Build the coolest Linux based applications with Moblin SDK & win
>>>
>> great prizes
>>
>>> Grand prize is a trip for two to an Open Source event anywhere in
the
>>>
>> world
>>
>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>>> -------------------------------------------------------------------
--
>>>
>> ---
>>
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Matplotlib-users@lists.sourceforge.net
>>> matplotlib-users List Signup and Options
>>>
>> --
>> Michael Droettboom
>> Science Software Branch
>> Operations and Engineering Division
>> Space Telescope Science Institute
>> Operated by AURA for NASA
>>
>>
>> --------------------------------------------------------------------
---
>> --
>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>> challenge
>> Build the coolest Linux based applications with Moblin SDK & win
great
>> prizes
>> Grand prize is a trip for two to an Open Source event anywhere in
the
>> world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> matplotlib-users List Signup and Options
>>
>> No virus found in this incoming message.
>> Checked by AVG - http://www.avg.com
>> Version: 8.0.175 / Virus Database: 270.9.10/1811 - Release Date:
>> 11/25/2008 8:29 AM
>>
>
> ---------------------------------------------------------------------
----
> This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge
> Build the coolest Linux based applications with Moblin SDK & win
great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the
world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> matplotlib-users List Signup and Options
>
--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
No virus found in this incoming message.
Checked by AVG - http://www.avg.com
Version: 8.0.175 / Virus Database: 270.9.10/1811 - Release Date:
11/25/2008 8:29 AM