You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
(12) |
Sep
(12) |
Oct
(56) |
Nov
(65) |
Dec
(37) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(59) |
Feb
(78) |
Mar
(153) |
Apr
(205) |
May
(184) |
Jun
(123) |
Jul
(171) |
Aug
(156) |
Sep
(190) |
Oct
(120) |
Nov
(154) |
Dec
(223) |
2005 |
Jan
(184) |
Feb
(267) |
Mar
(214) |
Apr
(286) |
May
(320) |
Jun
(299) |
Jul
(348) |
Aug
(283) |
Sep
(355) |
Oct
(293) |
Nov
(232) |
Dec
(203) |
2006 |
Jan
(352) |
Feb
(358) |
Mar
(403) |
Apr
(313) |
May
(165) |
Jun
(281) |
Jul
(316) |
Aug
(228) |
Sep
(279) |
Oct
(243) |
Nov
(315) |
Dec
(345) |
2007 |
Jan
(260) |
Feb
(323) |
Mar
(340) |
Apr
(319) |
May
(290) |
Jun
(296) |
Jul
(221) |
Aug
(292) |
Sep
(242) |
Oct
(248) |
Nov
(242) |
Dec
(332) |
2008 |
Jan
(312) |
Feb
(359) |
Mar
(454) |
Apr
(287) |
May
(340) |
Jun
(450) |
Jul
(403) |
Aug
(324) |
Sep
(349) |
Oct
(385) |
Nov
(363) |
Dec
(437) |
2009 |
Jan
(500) |
Feb
(301) |
Mar
(409) |
Apr
(486) |
May
(545) |
Jun
(391) |
Jul
(518) |
Aug
(497) |
Sep
(492) |
Oct
(429) |
Nov
(357) |
Dec
(310) |
2010 |
Jan
(371) |
Feb
(657) |
Mar
(519) |
Apr
(432) |
May
(312) |
Jun
(416) |
Jul
(477) |
Aug
(386) |
Sep
(419) |
Oct
(435) |
Nov
(320) |
Dec
(202) |
2011 |
Jan
(321) |
Feb
(413) |
Mar
(299) |
Apr
(215) |
May
(284) |
Jun
(203) |
Jul
(207) |
Aug
(314) |
Sep
(321) |
Oct
(259) |
Nov
(347) |
Dec
(209) |
2012 |
Jan
(322) |
Feb
(414) |
Mar
(377) |
Apr
(179) |
May
(173) |
Jun
(234) |
Jul
(295) |
Aug
(239) |
Sep
(276) |
Oct
(355) |
Nov
(144) |
Dec
(108) |
2013 |
Jan
(170) |
Feb
(89) |
Mar
(204) |
Apr
(133) |
May
(142) |
Jun
(89) |
Jul
(160) |
Aug
(180) |
Sep
(69) |
Oct
(136) |
Nov
(83) |
Dec
(32) |
2014 |
Jan
(71) |
Feb
(90) |
Mar
(161) |
Apr
(117) |
May
(78) |
Jun
(94) |
Jul
(60) |
Aug
(83) |
Sep
(102) |
Oct
(132) |
Nov
(154) |
Dec
(96) |
2015 |
Jan
(45) |
Feb
(138) |
Mar
(176) |
Apr
(132) |
May
(119) |
Jun
(124) |
Jul
(77) |
Aug
(31) |
Sep
(34) |
Oct
(22) |
Nov
(23) |
Dec
(9) |
2016 |
Jan
(26) |
Feb
(17) |
Mar
(10) |
Apr
(8) |
May
(4) |
Jun
(8) |
Jul
(6) |
Aug
(5) |
Sep
(9) |
Oct
(4) |
Nov
|
Dec
|
2017 |
Jan
(5) |
Feb
(7) |
Mar
(1) |
Apr
(5) |
May
|
Jun
(3) |
Jul
(6) |
Aug
(1) |
Sep
|
Oct
(2) |
Nov
(1) |
Dec
|
2018 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2025 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
|
|
|
|
1
(5) |
2
|
3
(3) |
4
(16) |
5
(8) |
6
(22) |
7
(10) |
8
(18) |
9
(11) |
10
(7) |
11
(16) |
12
(1) |
13
(10) |
14
(14) |
15
(2) |
16
(3) |
17
(19) |
18
(24) |
19
(35) |
20
(38) |
21
(27) |
22
(1) |
23
(9) |
24
(6) |
25
(24) |
26
(9) |
27
(7) |
28
(5) |
29
(9) |
30
(4) |
|
|
|
|
|
|
From: Jesper L. <jes...@gm...> - 2008-11-26 23:13:20
|
Hi matplotlib users, The script below produces weird arrows when using numpy 1.2.1 and matplotlib trunk. When I reinstall numpy 1.2.0 instead it seems fine. I use the Agg backend. I am not sure where to start in tracking the bug down so I will just post the rather sparse information that I have. Please let me know if you need any further information from me. Best regards, Jesper import math import numpy.ma as ma import pylab as p a = ma.ones((10,10)) a[:2,:] = ma.masked a[:,9:] = ma.masked b = ma.array(-a) nx, ny = a.shape for i in range(nx): for j in range(ny): a[i,j] = a[i,j]*math.cos(i*j) b[i,j] = -b[i,j]*math.sin(i*j) print a p.quiver(a,b) p.grid(True) p.savefig('test1.png') |
From: Tim M. <tim...@gm...> - 2008-11-26 22:34:25
|
Hello Mauro, > I am not just "trying", Sorry for "disregarding" your using the term trying. I am indeed implementing a software package > for species distribution mapping and biogeographic analysis, using > wxPython/Matplotlib. Thanks for being more specific. There is another program aiming at /similar/ goals: http://www.metamodellers.com/epigrass.html But this is not my domain of work... > And, by the way, it is going quite well. My crongrats! > Both Thuban and QGis, as generalized implementations of GIS, are far > from adequate for my needs (and of fellow conservation biologists). I just thought of there because they easyly convert CSV into geographical data. In case you are after format conversion you may see: ogr2ogr. > Hope this helps. Vice versa. I thought that my ideas my be useful. Nevertheless, have all possible sucess! Kind regards, Timmie |
From: Zane S. <za...@id...> - 2008-11-26 22:24:23
|
Does anybody have a good method for implementing cyclic boundaries in matplotlib axes? It's easy when plotting points to just mod() the values before sending them to the plot, but when drawing lines or patches, it would be nice if there were an underlying mechanism for intelligently splitting the patch or line when it runs off the edge (instead of either not seeing it, or calling mod() and getting the mess of lines dragged all the way across the plot to where they continue on the other side). I'd use this primarily for global-scale maps in Basemap... but I could see it being more generally useful when dealing with a periodic space where what you're interested in is the phase. Or maybe this already exists and I'm just not seeing it? -- Zane Selvans Amateur Earthling za...@id... 303/815-6866 http://zaneselvans.org PGP Key: 55E0815F |
From: Mauro C. <mau...@gm...> - 2008-11-26 20:07:56
|
Dear ALL, I want to plot lines ("edges") between a sequence of points ("nodes"), using the following code: from pylab import * import matplotlib.pyplot as plt nodes = load('nodes.dat') edges = load('edges.dat') n = nodes.shape[0] fig = plt.figure() ax = fig.add_subplot(1,1,1) plt.plot(nodes[:,0],nodes[:,1],'ob') for i in range(n): try: t = edges[i,0]-1 u = edges[i,1]-1 x = [nodes[t,0], nodes[u,0]] y = [nodes[t,1], nodes[u,1]] plot(x,y,'-b') except: continue plt.show() And here are the "nodes.dat" -61.05 10.4 -79.4333333333 9.15 -70.6666666667 9.53333333333 -63.1166666667 7.91666666667 -63.1166666667 10.55 -81.1833333333 7.51666666667 -56.4833333333 3.1 -60.5 3.93333333333 -81.0166666667 7.66666666667 -67.4333333333 8.93333333333 -65.9666666667 10.3166666667 -78.9333333333 8.38333333333 -72.8666666667 9.83333333333 -68.4 10.6166666667 -72.9833333333 10.6166666667 ...and "edges.dat" files: 1 5 4 5 5 11 10 11 10 14 3 14 3 13 13 15 4 8 7 8 12 13 2 12 2 9 6 9 The above code works quite well. However, I do *not* want to have the plot done for each edge inside the for loop; instead, I would like to have the x,y points stored for being plotted at once, using a plot command issued outside the loop. It seems that it could be done using MPL line collections, but I could not figure out how to do this. Any hints? Thanks in advance for any assistance you can provide. With best regards, -- Dr. Mauro J. Cavalcanti Ecoinformatics Studio P.O. Box 46521, CEP 20551-970 Rio de Janeiro, RJ, BRASIL E-mail: mau...@gm... Web: http://studio.infobio.net Linux Registered User #473524 * Ubuntu User #22717 "Life is complex. It consists of real and imaginary parts." |
From: Zane S. <za...@id...> - 2008-11-26 18:07:46
|
I want to change the size of the lat/lon labels on a Basemap map, and from the documentation, it seems like this ought to be possible using drawparallels() and drawmeridians() with a keword argument, e.g.: linmap.drawparallels(range(-90,90,30), labels=[1,0,0,1], fontsize='x- small') but that doesn't have any effect. I've also tried size='x-small' and size/fontsize=9 and none of them seem to do anything. I also can't seem to obtain lists of ticklabels from the Axes instance that the map is inside of, to change their sizes. On normal (non-Basemap) figures, I can do something like: for ticklabel in ax.get_xticklabels(): ticklabel.set_size('x-small') to re-size them after the fact, but on the Basemap axes, get_xticklabels() returns a zero length list. Does anybody know where are these things hiding? Thanks! Zane -- Zane Selvans Amateur Earthling za...@id... 303/815-6866 http://zaneselvans.org PGP Key: 55E0815F |
From: Michael D. <md...@st...> - 2008-11-26 18:05:35
|
I can confirm that this is broken in 0.98.3 and fixed in SVN. It's not clear if a simple patch is possible -- the fix actually extends over a number of changesets. If you're able to build from SVN, I'm rather certain that should resolve this issue. Otherwise, you may have to wait for the next release. Cheers, Mike John Mariska wrote: > Hi Mike, > > Thanks for the prompt response to my post. I've tried your solution > and have not been successful. Am not running the svn head, but am at > 0.98.3. Here is the little test code I have: > > #!/usr/bin/env python > > import numpy as np > import matplotlib as mpl > mpl.use('PS') > from matplotlib.pyplot import figure, show > > mpl.rc('font', size=20) > mpl.rc('ps', useafm=True) > mpl.rc('text', usetex=False) > > fig = figure() > fig.subplots_adjust(bottom=0.15, left=0.15) > > x = np.arange(0.0, 10.2, 0.2) > > ax = fig.add_subplot(111) > ax.plot(x, np.sin(x), 'bo') > > ax.set_xlabel(r'x (cm$\mathsf{^{-3}}$)') > ax.set_ylabel(r'y (ergs cm$\mathsf{^{-2}}$ s$^{-1}$)') > > show() > fig.savefig('test_latex.eps') > > If I do a grep findfont test_latex.eps, the result is: > > /Helvetica findfont > /Helvetica findfont > /Helvetica findfont > /Helvetica findfont > /Helvetica findfont > /Helvetica findfont > /BitstreamVeraSans-Roman findfont > /Cmsy10 findfont > /Cmr10 findfont > /BitstreamVeraSans-Roman findfont > /Helvetica findfont > /Helvetica findfont > /Helvetica findfont > /Helvetica findfont > /Helvetica findfont > /BitstreamVeraSans-Roman findfont > /Cmsy10 findfont > /Cmr10 findfont > /BitstreamVeraSans-Roman findfont > /Cmsy10 findfont > /Cmr10 findfont > /BitstreamVeraSans-Roman findfont > > I've also messed with making the changes in the matplolibrc file, > without complete success. It may just be that this area of matplotlib > is still a moving target. > > John M. > > Michael Droettboom wrote: >> If you have "ps.useafm" set to True, (and "text.usetex" set to >> False), the mathtext renderer will stick to the standard 35 ps fonts, >> with the obvious limitations in the number of symbols available, and >> no radical signs, etc. By default, all math is serif (in this case >> Times). You can force sans-serif (Helvetica), by wrapping the math >> in \mathsf{}, eg. >> >> r'ergs cm$\mathsf{^{-2}}$ s$\mathsf{^{-1}}$' >> >> Let me know if the above doesn't work for you. I only tested with >> SVN head. >> >> Cheers, >> Mike >> >> John Mariska wrote: >>> Many scientific journals ask that authors submit figures as eps >>> files, preferably using one of the standard 35 ps fonts--usually >>> Helvetica or Times. I've been able to tweak the matplotlib.rc >>> file to make eps plot files that have all the numbers and labels >>> in Helvetica (or Times), but have a problem dealing with simple >>> superscipts and subscripts. Is there a way to get simple LaTeX >>> strings, such as r'ergs cm$^{-2}$ s$^{-1}$', to use only >>> Helvetica or Times? >>> >>> John Mariska >>> >>> ------------------------------------------------------------------------- >>> >>> 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 >>> 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: Michael D. <md...@st...> - 2008-11-26 15:59:54
|
If you have "ps.useafm" set to True, (and "text.usetex" set to False), the mathtext renderer will stick to the standard 35 ps fonts, with the obvious limitations in the number of symbols available, and no radical signs, etc. By default, all math is serif (in this case Times). You can force sans-serif (Helvetica), by wrapping the math in \mathsf{}, eg. r'ergs cm$\mathsf{^{-2}}$ s$\mathsf{^{-1}}$' Let me know if the above doesn't work for you. I only tested with SVN head. Cheers, Mike John Mariska wrote: > Many scientific journals ask that authors submit figures as eps > files, preferably using one of the standard 35 ps fonts--usually > Helvetica or Times. I've been able to tweak the matplotlib.rc > file to make eps plot files that have all the numbers and labels > in Helvetica (or Times), but have a problem dealing with simple > superscipts and subscripts. Is there a way to get simple LaTeX > strings, such as r'ergs cm$^{-2}$ s$^{-1}$', to use only > Helvetica or Times? > > John Mariska > > ------------------------------------------------------------------------- > 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 > 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: John M. <ma...@nr...> - 2008-11-26 15:51:56
|
Many scientific journals ask that authors submit figures as eps files, preferably using one of the standard 35 ps fonts--usually Helvetica or Times. I've been able to tweak the matplotlib.rc file to make eps plot files that have all the numbers and labels in Helvetica (or Times), but have a problem dealing with simple superscipts and subscripts. Is there a way to get simple LaTeX strings, such as r'ergs cm$^{-2}$ s$^{-1}$', to use only Helvetica or Times? John Mariska |
From: Nils W. <nw...@ia...> - 2008-11-26 07:11:17
|
Hi all, I would like to visualize the ovality of a perturbed circular path by a polar plot. How can I improve the view wrt to scaling and ticks ? from pylab import linspace, polar, xticks, yticks, show, savefig, subplot, figure from numpy.random import rand from numpy import ones, exp, pi, r_ theta = linspace(0.,2*pi,25) r = 20.*ones(24) r = r_[r,r[0]] noise = 2.*rand(24)-ones(24) noise = r_[noise,noise[0]] figure(1) polar(theta,(r+noise)) figure(2) polar(theta,(r+noise)/r) show() Any pointer would be appreciated. Nils |
From: Mauro C. <mau...@gm...> - 2008-11-25 23:30:12
|
Dear Tim, Thanks for your message. I am not just "trying", I am indeed implementing a software package for species distribution mapping and biogeographic analysis, using wxPython/Matplotlib. And, by the way, it is going quite well. Both Thuban and QGis, as generalized implementations of GIS, are far from adequate for my needs (and of fellow conservation biologists). Hope this helps. Best regards, 2008/11/25 Tim Michelsen <tim...@gm...>: > Hello! > >> I am attaching the current version of source code plus a screenshot. > > I would like to ask you why you are trying to implement this by yourself > in wxPython/matplotlib. > > There are already two pythonised applications that may be used for your > purpose. And they are aware of the projections and different > geographical formats: > * QGIS with Pythons libary and plugins: > http://qgis.org/content/view/145/113/ > > * Thuban: http://thuban.intevation.org/ > > Maybe this could save you some work/time. > > Kind regards, > Timmie > > > ------------------------------------------------------------------------- > 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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- Dr. Mauro J. Cavalcanti Ecoinformatics Studio P.O. Box 46521, CEP 20551-970 Rio de Janeiro, RJ, BRASIL E-mail: mau...@gm... Web: http://studio.infobio.net Linux Registered User #473524 * Ubuntu User #22717 "Life is complex. It consists of real and imaginary parts." |
From: John H. <jd...@gm...> - 2008-11-25 22:11:20
|
On Tue, Nov 25, 2008 at 3:16 PM, John Hunter <jd...@gm...> wrote: > If the unicode minus is sufficiently problematic for you, I can add an > rc param. Something like > > axis.unicode_minus : True Added as rc param 'axes.unicode_minus' in svn r6453 with example examples/api/unicode_minus.py But I definitely second Michael's suggestion -- you don't want to be parsing ticklabels if you don't have too! JDH |
From: Michael D. <md...@st...> - 2008-11-25 21:23:51
|
No worries. I'm sort of a Unicode/i18n/typesetting geek, I guess... ;) Mike Drain, Theodore R wrote: > OK - Thanks for the explanation. Sorry you had to type such a long response to my short little complaint :) > > >> -----Original Message----- >> From: Michael Droettboom [mailto:md...@st...] >> Sent: Tuesday, November 25, 2008 1:06 PM >> To: Drain, Theodore R >> Cc: mat...@li... >> 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:md...@st...] >>>> Sent: Tuesday, November 25, 2008 12:25 PM >>>> To: Nils Wagner >>>> Cc: mat...@li... >>>> 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 >>>>> 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 >>>> >>>> >>>> -------------------------------------------------------------------- >>>> >> --- >> >>>> -- >>>> 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 >>>> Mat...@li... >>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>>> >>>> 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 >>> 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 >> >> >> 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 > 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: Michael D. <md...@st...> - 2008-11-25 21:23:42
|
John Hunter wrote: > The problem here appears to be in > matplotlib.projects.polar.ThetaFormatter.__call__, which uses the > degree symbol. I think all we need to do is return the proper tex > string in this case. Michael, does this look right to you: > > def __call__(self, x, pos=None): > # \u00b0 : degree symbol > if rcParams['text.usetex'] and not rcParams['text.latex.unicode']: > return r"$%d^\circ$" % ((x / npy.pi) * 180.0) > else: > return u"%d\u00b0" % ((x / npy.pi) * 180.0) > Yeah. Looks good. Though a "usetex" guy should probably comment as to whether "text.latex.unicode == False" is still a good default. BTW -- the reason I didn't want to use the math syntax in the common case is so that it will work correctly with any arbitrary font (assuming it has a degree sign), whereas $5\circ$ will only work correctly with one of the supported math fonts (Computer Modern and STIX). For usetex, of course, it works fine. Cheers, Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA |
From: Drain, T. R <the...@jp...> - 2008-11-25 21:20:14
|
OK - Thanks for the explanation. Sorry you had to type such a long response to my short little complaint :) > -----Original Message----- > From: Michael Droettboom [mailto:md...@st...] > Sent: Tuesday, November 25, 2008 1:06 PM > To: Drain, Theodore R > Cc: mat...@li... > 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:md...@st...] > >> Sent: Tuesday, November 25, 2008 12:25 PM > >> To: Nils Wagner > >> Cc: mat...@li... > >> 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 > >>> 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 > >> > >> > >> -------------------------------------------------------------------- > --- > >> -- > >> 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 > >> Mat...@li... > >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users > >> > >> 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 > > 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 > > > 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 |
From: John H. <jd...@gm...> - 2008-11-25 21:16:07
|
On Tue, Nov 25, 2008 at 2:40 PM, Drain, Theodore R <the...@jp...> 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". > > I think Unicode is starting to creep into the source in various places - 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... > > (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). This was supposed to be a feature not a bug. As far as I understand, we are now using the proper minus sign which has the same width as the horizontal part or a plus sign. See http://en.wikipedia.org/wiki/Plus_sign#Plus_sign in the section "Character codes". The hyphen, which doubles as a minus sign in the ascii character set, is not the proper character for typesetting. I don't think this is the problem Nils is having, because the character code for the minus sign is different (and in the formatter, we explicitly convert this if usetex is True) in the ScalarFormatter.fix_minus method. If the unicode minus is sufficiently problematic for you, I can add an rc param. Something like axis.unicode_minus : True The problem here appears to be in matplotlib.projects.polar.ThetaFormatter.__call__, which uses the degree symbol. I think all we need to do is return the proper tex string in this case. Michael, does this look right to you: def __call__(self, x, pos=None): # \u00b0 : degree symbol if rcParams['text.usetex'] and not rcParams['text.latex.unicode']: return r"$%d^\circ$" % ((x / npy.pi) * 180.0) else: return u"%d\u00b0" % ((x / npy.pi) * 180.0) |
From: Tim M. <tim...@gm...> - 2008-11-25 21:12:27
|
Hello! > I am attaching the current version of source code plus a screenshot. I would like to ask you why you are trying to implement this by yourself in wxPython/matplotlib. There are already two pythonised applications that may be used for your purpose. And they are aware of the projections and different geographical formats: * QGIS with Pythons libary and plugins: http://qgis.org/content/view/145/113/ * Thuban: http://thuban.intevation.org/ Maybe this could save you some work/time. Kind regards, Timmie |
From: Michael D. <md...@st...> - 2008-11-25 21:06:35
|
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:md...@st...] >> Sent: Tuesday, November 25, 2008 12:25 PM >> To: Nils Wagner >> Cc: mat...@li... >> 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 >>> 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 >> >> >> ----------------------------------------------------------------------- >> -- >> 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 >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> 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 > 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: Drain, T. R <the...@jp...> - 2008-11-25 20:41:14
|
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". I think Unicode is starting to creep into the source in various places - 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... (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). Ted > -----Original Message----- > From: Michael Droettboom [mailto:md...@st...] > Sent: Tuesday, November 25, 2008 12:25 PM > To: Nils Wagner > Cc: mat...@li... > 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 > > 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 > > > ----------------------------------------------------------------------- > -- > 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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > 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 |
From: Michael D. <md...@st...> - 2008-11-25 20:25:59
|
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=medium > 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 > 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: Ryan M. <rm...@gm...> - 2008-11-25 20:15:22
|
Fago, Matt - AES wrote: > [I'm not sure if this is best in 'devel' or 'users'] > > I'm trying to compute PSDs using matplotlib.mlab.psd and came across the "PSD amplitudes" thread from last year: > > http://sourceforge.net/mailarchive/message.php?msg_id=472101A6.9080206%40isla.hawaii.edu > > Using the latest version of psd on svn trunk (rev 6429) that added support for pad_to, I can now compute the Matlab pwelch > example using matplotlib. This example is given in the Signal Processing Toolbox User's Guide: > > http://www.mathworks.com/access/helpdesk/help/pdf_doc/signal/signal_tb.pdf > > (look on pages 2-23 and 2-24). Note I do not have easy access to Matlab itself, so I'm just using this published example. > > The Matlab code is as follows: > > randn('state',1) > fs = 1000; % Sampling frequency > t = (0:0.3*fs)./fs; % 301 samples > A = [2 8]; % Sinusoid amplitudes (row vector) > f = [150;140]; % Sinusoid frequencies (column vector) > xn = A*sin(2*pi*f*t) + 5*randn(size(t)); > Hs = spectrum.welch('rectangular',150,50); > psd(Hs,xn,'Fs',fs,'NFFT',512); > > This produces a fairly noisy signal from -20 to -10 dB, with a strong peak of ~6 dB at 150 Hz (see the plot on page 2-24). > > While my equivalent (?) python code is: > > from scipy import * > from mlabsvn import psd # This is a local copy of svn revision 6429 of matplotlib.mlab > from pylab import * > fs=1000 > t=linspace(0,0.3,0.3*fs+1) > A=[2,8] > f=[150,140] > xn=A[0]*sin(2*pi*f[0]*t) + A[1]*sin(2*pi*f[1]*t) + 5*randn(len(t)) > Pxx,freqs = psd(xn,Fs=fs,NFFT=150,noverlap=75,pad_to=512) > > figure() > plot(freqs, 10*log10(Pxx) ) > show() > > However, this produces a peak of over 30 dB at 150 Hz. Unless there is a mistake in my code above, there seems to be a > significant difference between the matplotlib and matlab implementations. > > I noticed that the values 10*log10(Pxx/len(xn)) produces results that match much better. Without looking more closely at the > code for psd and reviewing Bendat and Piersol I cannot be sure that this is the correct fix. > > Does anyone else have any insight? When is the next release planned, and how likely is a fix? I don't have any insight yet, but since I'm the guy who just tweaked it, I guess I'm on the hook to fix it. :) I'll try to take a look this afternoon. Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma |
From: Nils W. <nw...@ia...> - 2008-11-25 20:11:13
|
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=medium 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 |
From: Fago, M. - A. <Mat...@it...> - 2008-11-25 20:05:17
|
[I'm not sure if this is best in 'devel' or 'users'] I'm trying to compute PSDs using matplotlib.mlab.psd and came across the "PSD amplitudes" thread from last year: http://sourceforge.net/mailarchive/message.php?msg_id=472101A6.9080206%40isla.hawaii.edu Using the latest version of psd on svn trunk (rev 6429) that added support for pad_to, I can now compute the Matlab pwelch example using matplotlib. This example is given in the Signal Processing Toolbox User's Guide: http://www.mathworks.com/access/helpdesk/help/pdf_doc/signal/signal_tb.pdf (look on pages 2-23 and 2-24). Note I do not have easy access to Matlab itself, so I'm just using this published example. The Matlab code is as follows: randn('state',1) fs = 1000; % Sampling frequency t = (0:0.3*fs)./fs; % 301 samples A = [2 8]; % Sinusoid amplitudes (row vector) f = [150;140]; % Sinusoid frequencies (column vector) xn = A*sin(2*pi*f*t) + 5*randn(size(t)); Hs = spectrum.welch('rectangular',150,50); psd(Hs,xn,'Fs',fs,'NFFT',512); This produces a fairly noisy signal from -20 to -10 dB, with a strong peak of ~6 dB at 150 Hz (see the plot on page 2-24). While my equivalent (?) python code is: from scipy import * from mlabsvn import psd # This is a local copy of svn revision 6429 of matplotlib.mlab from pylab import * fs=1000 t=linspace(0,0.3,0.3*fs+1) A=[2,8] f=[150,140] xn=A[0]*sin(2*pi*f[0]*t) + A[1]*sin(2*pi*f[1]*t) + 5*randn(len(t)) Pxx,freqs = psd(xn,Fs=fs,NFFT=150,noverlap=75,pad_to=512) figure() plot(freqs, 10*log10(Pxx) ) show() However, this produces a peak of over 30 dB at 150 Hz. Unless there is a mistake in my code above, there seems to be a significant difference between the matplotlib and matlab implementations. I noticed that the values 10*log10(Pxx/len(xn)) produces results that match much better. Without looking more closely at the code for psd and reviewing Bendat and Piersol I cannot be sure that this is the correct fix. Does anyone else have any insight? When is the next release planned, and how likely is a fix? Thanks, Matt This e-mail and any files transmitted with it may be proprietary and are intended solely for the use of the individual or entity to whom they are addressed. If you have received this e-mail in error please notify the sender. Please note that any views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of ITT Corporation. The recipient should check this e-mail and any attachments for the presence of viruses. ITT accepts no liability for any damage caused by any virus transmitted by this e-mail. |
From: Michael D. <md...@st...> - 2008-11-25 15:25:57
|
I introduced this bug trying to fix the Cairo backend on Nov 12. (r6400). It should now be fixed in SVN r6446. You will need to remove ~/.matplotlibrc/fontList.cache for the fix to take effect. Mike Michael Droettboom wrote: > I'm seeing this here, too. Something must have been messed up recently > in SVN. I'm looking into it. > > Mike > > Zane Selvans wrote: > >>> We have two modes to render latex -- one is native TeX layout and uses >>> latex and dvipng, and is superior if you need all of TeX's >>> capabilities (eg an eqnarray), but the fonts are suboptimal. The >>> other is mathtext, which will cover 98% of most users' math needs, >>> does not require a latex install because it is pure mpl, and uses >>> nicer fonts . >>> >> Well, if I turn off usetex, then the LaTeX symbols don't get rendered >> correctly. It's obviously trying to do something other than just >> write out the plain text, but it's not doing the right thing. I quit >> out of matplotlib, and re-purged all the cached stuff from my >> .matplotlib directory, and it's still failing. From the docs, it >> sounds like mathtext is just the default way for Text objects to get >> rendered. It fails the same way irrespective of whether I use a raw >> string, or a double-quoted string: >> >> fit_ax.set_ylabel(r'$\delta_{rms}$ [degrees]') >> fit_ax.set_ylabel("$\delta_{rms}$ [degrees]") >> >> both give a capital 'C' with a subscript 'rms' >> >> $\bar{D}$ results in a capital D with a little circle over it. >> >> $20^\circ$ yields 20 raised to the little tiny 'e' power. >> Even if I wipe my site-packages/matplotlib* directory and egg-info, >> make clean, and recompile and install matplotlib from the SVN source, >> I still get the same problem. I don't know if it means anything, but >> I note that the mpl-data/fonts directory in SVN has 282 sub-entries, >> and the mpl-data/fonts directory that's getting installed in my >> site-packages only has 99 sub-entries. But maybe they aren't supposed >> to be the same? Dunno. >> So for now I can only get my math symbols to render with text.usetext >> turned on. >> > I'm seeing > > -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA |
From: Michael D. <md...@st...> - 2008-11-25 15:15:35
|
I'm seeing this here, too. Something must have been messed up recently in SVN. I'm looking into it. Mike Zane Selvans wrote: >> We have two modes to render latex -- one is native TeX layout and uses >> latex and dvipng, and is superior if you need all of TeX's >> capabilities (eg an eqnarray), but the fonts are suboptimal. The >> other is mathtext, which will cover 98% of most users' math needs, >> does not require a latex install because it is pure mpl, and uses >> nicer fonts . > > Well, if I turn off usetex, then the LaTeX symbols don't get rendered > correctly. It's obviously trying to do something other than just > write out the plain text, but it's not doing the right thing. I quit > out of matplotlib, and re-purged all the cached stuff from my > .matplotlib directory, and it's still failing. From the docs, it > sounds like mathtext is just the default way for Text objects to get > rendered. It fails the same way irrespective of whether I use a raw > string, or a double-quoted string: > > fit_ax.set_ylabel(r'$\delta_{rms}$ [degrees]') > fit_ax.set_ylabel("$\delta_{rms}$ [degrees]") > > both give a capital 'C' with a subscript 'rms' > > $\bar{D}$ results in a capital D with a little circle over it. > > $20^\circ$ yields 20 raised to the little tiny 'e' power. > Even if I wipe my site-packages/matplotlib* directory and egg-info, > make clean, and recompile and install matplotlib from the SVN source, > I still get the same problem. I don't know if it means anything, but > I note that the mpl-data/fonts directory in SVN has 282 sub-entries, > and the mpl-data/fonts directory that's getting installed in my > site-packages only has 99 sub-entries. But maybe they aren't supposed > to be the same? Dunno. > So for now I can only get my math symbols to render with text.usetext > turned on. I'm seeing -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA |
From: Paul I. <piv...@gm...> - 2008-11-25 09:28:48
|
Hey John and the rest of the MPL gang: I've made the changes you suggested, but the problem is looking to be deeper than it seemed. I'm also moving this conversation to matplotlib-devel, since that's probably the more appropriate place for it. This updated patch allows for the creation of colormaps with various alphas, but there is likely more work to be done so that mpl can consistently make use of it (because it seems like all built-in cmaps are RGB, not RGBA). In trying to come up with an example that exercises the new capabilities, I found out that methods like scatter and countourf modify the colormap you give them and reset all of the alpha values to 1. I think this is because inside collections, we pass self._alpha, which is the Artist._alpha, and 1.0 by default, when making calls such as: _colors.colorConverter.to_rgba_array(c, self._alpha) ...Thus resetting all of alpha values. I was able to get around this by allowing collections to take on an alpha value of None, and then passing alpha=None to scatter and countourf, for example. There are probably other places where such a change should be done, unless someone has a better idea for how do do this. I updated examples/pylab/plot_scatter.py to show off the new capability. Another thing that I was unable to get around is that if you now make a plot using the same colormap but omit the alpha=None parameter, or set it to something other than None, it will reset the alpha values on the previous plot: figure(2) c = scatter(theta, r, c=colors, s=area,cmap=myColormap,alpha=None) will do the right thing, but calling scatter without alpha=None figure(3) d = scatter(theta, r, c=colors, s=area,cmap=myColormap) or d = scatter(theta, r, c=colors, s=area,cmap=myColormap, alpha=.5) will reset all of the alpha values in myColormap to 1 or .5. You can do c.cmap._init() to reset its original alpha values, and if you force a redraw on figure(2) (by panning or zooming on it, for example), it will look right again. However, if you go and fiddle with figure(3) (pan/zoom), and come back to figure(2), panning or zooming will cause all of the alpha values will be reset again. I'm not sure if it would be worth it to make a copy of the colormap to prevent this from happening. Anyone have thoughts on this? (the full example of this is commented with FIXME: in polar_scatter.py) best, Paul Ivanov John Hunter, on 2008-11-23 07:36, wrote: > On Sun, Nov 23, 2008 at 2:01 AM, Paul Ivanov <piv...@gm...> wrote: >> I took a stab at it, how does this look? >> >> I also took the liberty of adding alpha to LinearSegmentedColormap and >> updated its docstring changing two somewhat ambiguous uses of the word >> 'entry' with 'key' and 'value'. > > Hey Paul, > > Thanks for taking this on. I haven't tested this but I read the patch > and have some inline comments below. Some additional comments: > > * the patch should include a section in the CHANGELOG and > API_CHANGES letting people know what is different. > > * you should run examples/tests/backend_driver.py and make sure all > the examples still run, checking the output of some of the mappable > types (images, scaltter, pcolor...) > > * it would be nice to have an example in the examples dir which > exercises the new capabilities. > > See also, in case you haven't, > http://matplotlib.sourceforge.net/devel/coding_guide.html, which > covers some of this in more detail. > > Thanks again! Comments below: > > Index: lib/matplotlib/colors.py > =================================================================== > --- lib/matplotlib/colors.py (revision 6431) > +++ lib/matplotlib/colors.py (working copy) > @@ -452,7 +452,7 @@ > self._isinit = False > > > - def __call__(self, X, alpha=1.0, bytes=False): > + def __call__(self, X, alpha=None, bytes=False): > """ > *X* is either a scalar or an array (of any dimension). > If scalar, a tuple of rgba values is returned, otherwise > @@ -466,9 +466,10 @@ > """ > You need to document what alpha can be here: what does None mean, can > it be an array, scalar, etc... > > if not self._isinit: self._init() > - alpha = min(alpha, 1.0) # alpha must be between 0 and 1 > - alpha = max(alpha, 0.0) > - self._lut[:-3, -1] = alpha > + if alpha: > > I prefer to explicitly use "if alpha is None", since there are other > things that would test False (0, [], '') that you probably don't mean. > > + alpha = min(alpha, 1.0) # alpha must be between 0 and 1 > + alpha = max(alpha, 0.0) > > You should be able to use np.clip(alpha, 0, 1) here, but we should > consider instead raising for illegal alpha values since this will be > more helpful to the user. I realize some of this is inherited code > from before your changes, but we can improve it while making this > patch. > > + self._lut[:-3, -1] = alpha > mask_bad = None > if not cbook.iterable(X): > vtype = 'scalar' > @@ -558,9 +559,10 @@ > def __init__(self, name, segmentdata, N=256): > """Create color map from linear mapping segments > > - segmentdata argument is a dictionary with a red, green and blue > - entries. Each entry should be a list of *x*, *y0*, *y1* tuples, > - forming rows in a table. > + segmentdata argument is a dictionary with red, green and blue > + keys. An optional alpha key is also supported. Each value > + should be a list of *x*, *y0*, *y1* tuples, forming rows in a > + table. > > Example: suppose you want red to increase from 0 to 1 over > the bottom half, green to do the same over the middle half, > @@ -606,6 +608,8 @@ > self._lut[:-3, 0] = makeMappingArray(self.N, > self._segmentdata['red']) > self._lut[:-3, 1] = makeMappingArray(self.N, > self._segmentdata['green']) > self._lut[:-3, 2] = makeMappingArray(self.N, > self._segmentdata['blue']) > + if self._segmentdata.has_key('alpha'): > + self._lut[:-3, 3] = makeMappingArray(self.N, > self._segmentdata['blue']) > > Is this what you meant? I think you would use 'alpha' rather than > 'blue' here, no? > > self._isinit = True > self._set_extremes() > > @@ -664,11 +668,10 @@ > > > def _init(self): > - rgb = np.array([colorConverter.to_rgb(c) > + rgba = np.array([colorConverter.to_rgba(c) > for c in self.colors], np.float) > self._lut = np.zeros((self.N + 3, 4), np.float) > - self._lut[:-3, :-1] = rgb > - self._lut[:-3, -1] = 1 > + self._lut[:-3] = rgba > self._isinit = True > self._set_extremes() |