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
(17) |
3
(13) |
4
(17) |
5
(26) |
6
(13) |
7
(9) |
8
(8) |
9
(13) |
10
(25) |
11
(19) |
12
(24) |
13
(12) |
14
|
15
|
16
(5) |
17
(10) |
18
(7) |
19
|
20
(7) |
21
(2) |
22
(3) |
23
(11) |
24
(19) |
25
(17) |
26
(6) |
27
(10) |
28
(2) |
29
(4) |
30
(15) |
|
|
|
|
|
Hi, I'm plotting an array, stored as 'data'. It starts out as just the data, but I add little strips on the left and bottom to highlight certain ranges (black where I want the highlights and white where I don't). I use concatenate to tack those strips onto my data array, so 'data' ends up bigger than it should be. I then want the ticks and labels to ignore the strips. I can set the major ticks explicitly like this: pylab.xticks(mlab.linspace(offset,data.shape[0],num_major_ticks) But I didn't see an obvious way to set the minor ticks explicitly. I made a fragile locator class like this:: class ExplicitLinearLocator(Locator): def __init__(self,vmin,vmax,numticks): self.vmin = vmin self.vmax = vmax self.numticks=numticks def __call__(self): return mlab.linspace(self.vmin,self.vmax,self.numticks) But it seems like I should either beef that up or just set the minor ticks explicitly. How do I do that? Thanks, -michael -- Biophysics Graduate Student Carlson Lab, University of Michigan http://www.umich.edu/~mlerner http://lernerclan.net
Matthias Michler wrote: > Hi everybody, > > some time ago I send the first mail concerning "pylab.autoscale_view()". > Unfortunately nobody reponsed - so I ask you again for any suggestions. > If I should set up another example or explain it, please let me know. > > best regards and thanks in advance for any hint, > Matthias > > On Tuesday 13 February 2007 13:21, Matthias Michler wrote: >> Hello everbody, >> >> sometimes I need an autoscaling when my new data points in a figure have >> small values compared to some deleted ones. So I thought >> ax.autoscale_view() would be the solution, but it seems to remember deleted >> data and so doesn't scale limits like I want. A little program showing my >> problem can be seen below. >> >> Could anyone help me or give me a little hint? The autoscaling mechanism does not keep track of plot elements, so it has no way of knowing what to change when you delete a line. You will have to keep track of the x and y extents of each element yourself, and manually reset the xlim and ylim when you want to rescale after deleting a line. This can be done with the Axes set_xlim and set_ylim methods. Eric >> >> Thanks in advance, >> >> Matthias >> >>> -------------------------------------------------------------------------- >>> - >> import pylab as P >> >> P.ion() >> P.figure() >> ax = P.subplot(111) >> P.plot(P.array([0,1]), P.array([0,2])) >> P.plot(P.array([1.1,2]), P.array([2.2,4])) >> P.draw() >> >> raw_input(" delete one graph by pressing <return>") >> ax.lines.pop(-1) >> P.draw() >> P.draw() >> >> raw_input(" manually setting new limits by pressing <return>") >> ax.set_autoscale_on = False >> ax.axis([-0.1, 1.1, -0.1, 2.1]) >> ax.set_autoscale_on = True >> P.draw() >> P.draw() >> >> raw_input(" do 'ax.autoscale_view()' by pressing <return> ") >> ax.autoscale_view() >> P.draw() >> P.draw() >> # autoscale_view() rescales to old limits with all of the data >> raw_input(" end programm by pressing <return>") >> P.ioff() >> >>> -------------------------------------------------------------------------- > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
it works fine for me with this change: def plotRocCurve(xCoord, yCoord): # TODO: solve rounding issues here #lines = pylab.plot(xCoord * 100, yCoord * 100, markersize = 2, linewidth = 0.5) lines = pylab.plot(xCoord, yCoord, markersize = 2, linewidth = 0.5) pylab.xlabel('False positives', fontsize = 10) pylab.ylabel('True positives', fontsize = 10) # pylab.axis([0.0, 1.0, 0.0, 1.0]) pylab.show() I get values between 0.0 and 1.0 I'm running OS-X 10.4 Python2.5 >>> numpy.__version__ '1.0.2' >>> matplotlib.__version__ '0.90.0' -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chr...@no...
Hi everybody, some time ago I send the first mail concerning "pylab.autoscale_view()". Unfortunately nobody reponsed - so I ask you again for any suggestions. If I should set up another example or explain it, please let me know. best regards and thanks in advance for any hint, Matthias On Tuesday 13 February 2007 13:21, Matthias Michler wrote: > Hello everbody, > > sometimes I need an autoscaling when my new data points in a figure have > small values compared to some deleted ones. So I thought > ax.autoscale_view() would be the solution, but it seems to remember deleted > data and so doesn't scale limits like I want. A little program showing my > problem can be seen below. > > Could anyone help me or give me a little hint? > > Thanks in advance, > > Matthias > > >-------------------------------------------------------------------------- > >- > > import pylab as P > > P.ion() > P.figure() > ax = P.subplot(111) > P.plot(P.array([0,1]), P.array([0,2])) > P.plot(P.array([1.1,2]), P.array([2.2,4])) > P.draw() > > raw_input(" delete one graph by pressing <return>") > ax.lines.pop(-1) > P.draw() > P.draw() > > raw_input(" manually setting new limits by pressing <return>") > ax.set_autoscale_on = False > ax.axis([-0.1, 1.1, -0.1, 2.1]) > ax.set_autoscale_on = True > P.draw() > P.draw() > > raw_input(" do 'ax.autoscale_view()' by pressing <return> ") > ax.autoscale_view() > P.draw() > P.draw() > # autoscale_view() rescales to old limits with all of the data > raw_input(" end programm by pressing <return>") > P.ioff() > > >--------------------------------------------------------------------------
David Koch wrote: > I have a "normalized" bunch of co-ordinates with x and y between 0 and 1 > - I have to multiply the values by 100 in order to get the curve I > expected to see, otherwise I don't get anything. What's going on? > > I did: > > pylab.plot(xCoord, yCoord) > pylab.show() we're going to need more info to help -- perhaps a complete script, and/or what values xCoord and yCoord have in them. In the meantime -- did you inadvertently use integer arrays? -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chr...@no...
Hi Jan, I'm not sure about the reason, but your little example runs for me using several backends (GtkAgg, TkAgg, WxAgg). I'm using Debian (kernel 2.6) and matplotlib 0.90.0 at revison 3131. Maybe it could help to add some more 'draw()' commands after plotting and reseting data - not really good style, but sometimes helpful. best regards, Matthias On Sunday 22 April 2007 18:50, Jan Winter wrote: > hi, > > I tried to plot in realtime: > >from pylab import * > > import time > > ion() > > x=arange(0,2*pi,.01) > line,=plot(x,sin(x)) > for i in arange(1,20): > line.set_ydata(sin(x+i/10.0)) > draw() > > > but nothing happens when the script runs. I just see the last plot after > the script has finished. Only a grey empty window during processing. > > I tried to start it in ipython (stated with --pylab) as well as with python > and pythonw on OS X Tiger. I use Pyhton 2.4 > matplotlib-0.87.7 > wxPython 2.8.0 > > any hints for me? > > thanks Jan
Hi Stephen, On Sunday 22 April 2007 23:35, Stephen Boulet wrote: > I wanted to use this code to set the label font in my legends: > from pylab.font_manager import fontManager, FontProperties > ... > but I'm getting "ImportError: No module named font_manager". > > Can someone help me set legend size? Thanks. I'm not sure about font properties at all, but for me the following seems to work: >>>from matplotlib.font_manager import fontManager regards, Matthias
Hi, I have a "normalized" bunch of co-ordinates with x and y between 0 and 1 - I have to multiply the values by 100 in order to get the curve I expected to see, otherwise I don't get anything. What's going on? I did: pylab.plot(xCoord, yCoord) pylab.show() ... no extra stuff Thank you, David
I wanted to use this code to set the label font in my legends: from pylab.font_manager import fontManager, FontProperties font = FontProperties(size='x-small') legend(legends,prop=font) but I'm getting "ImportError: No module named font_manager". Can someone help me set legend size? Thanks. Stephen
You might consider using the object oriented part of matplotlib instead of the matlab style of doing things. I tend to make my plots a plot() method of whatever kind of analysis class I've created: from pylab import figure class Analysis(object): def init(self): self.x = range(10) self.y = range(10) def plot(self): self.f = figure() # create a figure self.a = self.f.add_subplot(111) # create axes self.a.set_xlabel('time (s)') self.a.set_ylabel('value') self.a.plot(self.x, self.y) a = Analysis() a.plot() Cheers, Martin Hans Strotzer wrote: > Hi > > I'm using matplotlib for producing a bar-chart displaying my > electricity consumption. One thing that really annoys me is > that generally python code is quite visually appealing, the > same goes for the code in the matplotlib-examples. > The code I have produced here is frankly quite ugly > when it comes to setting all the properties I want. > Is there a smarter way of doing this, perhaps using dictionaries etc? > (I have attached the genereated png-file) > > cheers > > //Fredrik > -- > > from parser_el import * > from pylab import * > > > # Override some matplotlibrc defaults > # to get some nicer plots > rc('figure', figsize=(18,8)) > rc('figure.subplot', bottom=0.14) > rc('figure.subplot', left=0.04) > rc('figure.subplot', right=0.98) > > p = parser_el() > N = len(p.dates) > ind = arange(N) > p1 = bar(ind, p.kwh_avg, color='b', align='center') > > # change color of important bars... > for i in p.info: > if type(i)==datetime: > index = p.dates.index(i) > if index: > p1[index].set_facecolor('r') > > # Set axis, grid properties & use dates as xticks > title('kWh/Dygn') > ylabel('kWh') > axis([-1,N,0,110]) > locs, labels = xticks(ind, p.dates_string) > setp(labels, 'rotation', '270', 'ha', 'center', fontsize=10, > family='monospace') > xgridlines = getp(gca(), 'xgridlines') > ygridlines = getp(gca(), 'ygridlines') > setp(ygridlines, 'linestyle', '-') > setp(xgridlines, 'linestyle', 'None') > ax = subplot(111) > ax.yaxis.set_major_locator(MultipleLocator(10)) # Set y-gridlines > multiples of 10 > grid(True) > > text(0,85, p.info_string, bbox=dict(facecolor='darkturquoise', alpha=0.9)) > > # Store graph as image > savefig('el', dpi=80, orientation='landscape', format='png') > > show() > > = > > > > > ------------------------------------------------------------------------ > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > > > ------------------------------------------------------------------------ > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
hi, I tried to plot in realtime: from pylab import * import time ion() x=arange(0,2*pi,.01) line,=plot(x,sin(x)) for i in arange(1,20): line.set_ydata(sin(x+i/10.0)) draw() but nothing happens when the script runs. I just see the last plot after the script has finished. Only a grey empty window during processing. I tried to start it in ipython (stated with --pylab) as well as with python and pythonw on OS X Tiger. I use Pyhton 2.4 matplotlib-0.87.7 wxPython 2.8.0 any hints for me? thanks Jan -- "Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ... Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail
On 2007年4月22日, Hans Strotzer apparently wrote: > One thing that really annoys me is that generally python > code is quite visually appealing Tastes must vary! What is your point of comparison?? Controlling may graph properties is never going to be beautiful. But why not define a class that can build a figure with your desired defaults? > # change color of important bars... > for i in p.info: > if type(i)==datetime: > index = p.dates.index(i) > if index: > p1[index].set_facecolor('r') Apparently p.dates is NOT a list? (You seem to assume None is returned if a ValueError would be raised.) Anyway, maybe something like: colorindices = (p.dates.index(d) for d in p.info if d in p.dates) for index in colorindices: p1[index].set_facecolor('r') Cheers, Alan Isaac
Hi I'm using matplotlib for producing a bar-chart displaying my electricity consumption. One thing that really annoys me is that generally python code is quite visually appealing, the same goes for the code in the matplotlib-examples. The code I have produced here is frankly quite ugly when it comes to setting all the properties I want. Is there a smarter way of doing this, perhaps using dictionaries etc? (I have attached the genereated png-file) cheers //Fredrik -- from parser_el import * from pylab import * # Override some matplotlibrc defaults # to get some nicer plots rc('figure', figsize=3D(18,8)) rc('figure.subplot', bottom=3D0.14) rc('figure.subplot', left=3D0.04) rc('figure.subplot', right=3D0.98) p =3D parser_el() N =3D len(p.dates) ind =3D arange(N) p1 =3D bar(ind, p.kwh_avg, color=3D'b', align=3D'center') # change color of important bars... for i in p.info: if type(i)=3D=3Ddatetime: index =3D p.dates.index(i) if index: p1[index].set_facecolor('r') # Set axis, grid properties & use dates as xticks title('kWh/Dygn') ylabel('kWh') axis([-1,N,0,110]) locs, labels =3D xticks(ind, p.dates_string) setp(labels, 'rotation', '270', 'ha', 'center', fontsize=3D10, family=3D'monospace') xgridlines =3D getp(gca(), 'xgridlines') ygridlines =3D getp(gca(), 'ygridlines') setp(ygridlines, 'linestyle', '-') setp(xgridlines, 'linestyle', 'None') ax =3D subplot(111) ax.yaxis.set_major_locator(MultipleLocator(10)) # Set y-gridlines=20 multiples of 10 grid(True) text(0,85, p.info_string, bbox=3Ddict(facecolor=3D'darkturquoise', alpha=3D= 0.9)) # Store graph as image savefig('el', dpi=3D80, orientation=3D'landscape', format=3D'png') show() =3D --=20 Powered by Outblaze
Lionel Roubeyrie wrote: > By grd file, I mean csv like file, with one line by value, like > X1 Y1 Z1 > X2 Y1 Z2 > X3 Y1 Z3 > ... > X1 Y2 Zk > X2 Y2 Zk+1 > ... > Xi Yj Zn > this is in geographic format, where there is a repetition in the X values and > the Y values, because the grid is regular, but not in lambert projection, > then I can't retrieve the dimensions of the grid. > > [SNIP] Lionel: Well, I guess you are stuck without knowing what the dimensions of the grid are. Can't you find that out from the data provider? -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX : (303)497-6449 NOAA/OAR/PSD R/PSD1 Email : Jef...@no... 325 Broadway Office : Skaggs Research Cntr 1D-124 Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
By grd file, I mean csv like file, with one line by value, like X1 Y1 Z1 X2 Y1 Z2 X3 Y1 Z3 =2E.. X1 Y2 Zk X2 Y2 Zk+1 =2E.. Xi Yj Zn this is in geographic format, where there is a repetition in the X values a= nd=20 the Y values, because the grid is regular, but not in lambert projection,=20 then I can't retrieve the dimensions of the grid. Le Vendredi 20 Avril 2007 14:54, Jeff Whitaker a =E9crit=A0: > Lionel Roubeyrie wrote: > > Hi Jeff, > > yes, lambert is not the problem, you're right. I have some .grd files > > with x,y,z values, and I want to project z values on maps and interpola= te > > them. I don't have the dimensions of the shape, but with m.scatter(x, y, > > z), I see that the scatters are displayed in a regular grid. Then is > > there a way to retrieve the dimensions of the resulting grid, and then I > > can reshape z to pass it to contourf? > > Lionel: There should be an attribute or attributes in the netCDF file > that specify the dimensions of the grid (at least there should be, > according to the GMT documentation). > > > I tried to convert x and y to degrees, hoping removing the duplicated > > entries (with rouding) gives me the dimensions, but I also have a probl= em > > with m(x,y,inverse=3DTrue), because the results are not good ( I use m = =3D > > Basemap(llcrnrlon=3D0.5, llcrnrlat=3D44.8, urcrnrlon=3D2.8, urcrnrlat= =3D46.5, > > projection=3D'lcc', lat_1=3D45.89891889,lat_2=3D47.69601444,lon_0=3D2.3= 3722917)). > > thanks > > You shouldn't need to do that - just pass x,y and the reshaped z to > contourf. You do need to know the parameters of the projection though. > > -Jeff =2D-=20 Lionel Roubeyrie - lro...@li... Chag=E9 d'=E9tudes et de maintenance LIMAIR - la Surveillance de l'Air en Limousin http://www.limair.asso.fr
Lionel Roubeyrie wrote: > Hi Jeff, > yes, lambert is not the problem, you're right. I have some .grd files with > x,y,z values, and I want to project z values on maps and interpolate them. I > don't have the dimensions of the shape, but with m.scatter(x, y, z), I see > that the scatters are displayed in a regular grid. Then is there a way to > retrieve the dimensions of the resulting grid, and then I can reshape z to > pass it to contourf? > I tried to convert x and y to degrees, hoping removing the duplicated entries > (with rouding) gives me the dimensions, but I also have a problem with > m(x,y,inverse=True), because the results are not good ( I use m = > Basemap(llcrnrlon=0.5, llcrnrlat=44.8, urcrnrlon=2.8, urcrnrlat=46.5, > projection='lcc', lat_1=45.89891889,lat_2=47.69601444,lon_0=2.33722917)). > thanks Lionel: Basemap assumes that x=0,y=0 is the lower left corner of the projection region. You may have to adjust the x,y values coming from your grd file accordingly. -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449 325 Broadway Boulder, CO, USA 80305-3328
Lionel Roubeyrie wrote: > Hi Jeff, > yes, lambert is not the problem, you're right. I have some .grd files with > x,y,z values, and I want to project z values on maps and interpolate them. I > don't have the dimensions of the shape, but with m.scatter(x, y, z), I see > that the scatters are displayed in a regular grid. Then is there a way to > retrieve the dimensions of the resulting grid, and then I can reshape z to > pass it to contourf? > Lionel: There should be an attribute or attributes in the netCDF file that specify the dimensions of the grid (at least there should be, according to the GMT documentation). > I tried to convert x and y to degrees, hoping removing the duplicated entries > (with rouding) gives me the dimensions, but I also have a problem with > m(x,y,inverse=True), because the results are not good ( I use m = > Basemap(llcrnrlon=0.5, llcrnrlat=44.8, urcrnrlon=2.8, urcrnrlat=46.5, > projection='lcc', lat_1=45.89891889,lat_2=47.69601444,lon_0=2.33722917)). > thanks > You shouldn't need to do that - just pass x,y and the reshaped z to contourf. You do need to know the parameters of the projection though. -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449 325 Broadway Boulder, CO, USA 80305-3328
Hi Jeff, yes, lambert is not the problem, you're right. I have some .grd files with= =20 x,y,z values, and I want to project z values on maps and interpolate them. = I=20 don't have the dimensions of the shape, but with m.scatter(x, y, z), I see= =20 that the scatters are displayed in a regular grid. Then is there a way to=20 retrieve the dimensions of the resulting grid, and then I can reshape z to= =20 pass it to contourf?=20 I tried to convert x and y to degrees, hoping removing the duplicated entri= es=20 (with rouding) gives me the dimensions, but I also have a problem with=20 m(x,y,inverse=3DTrue), because the results are not good ( I use m =3D=20 Basemap(llcrnrlon=3D0.5, llcrnrlat=3D44.8, urcrnrlon=3D2.8, urcrnrlat=3D46.= 5,=20 projection=3D'lcc', lat_1=3D45.89891889,lat_2=3D47.69601444,lon_0=3D2.33722= 917)). thanks Le Vendredi 20 Avril 2007 13:11, Jeff Whitaker a =E9crit=A0: > Lionel Roubeyrie wrote: > > hi all, > > is there a way to plot (contourf) a .grd file from GMT directly with > > Basemap? I have a problem with contourf because I can't reshape to 2D t= he > > Z values ,x and y are in Lambert projection, so I can't compute the sha= pe > > :-( thanks > > Lionel: No, not directly. You have to read in the x,y,z values and > convert them to 2D arrays. You'll have to give more details on your > problem - just because x,y are in Lambert projection coordinates doesn't > mean you can't reshape z. > > -Jeff =2D-=20 Lionel Roubeyrie - lro...@li... Chag=E9 d'=E9tudes et de maintenance LIMAIR - la Surveillance de l'Air en Limousin http://www.limair.asso.fr
Lionel Roubeyrie wrote: > hi all, > is there a way to plot (contourf) a .grd file from GMT directly with Basemap? > I have a problem with contourf because I can't reshape to 2D the Z values ,x > and y are in Lambert projection, so I can't compute the shape :-( > thanks > > Lionel: No, not directly. You have to read in the x,y,z values and convert them to 2D arrays. You'll have to give more details on your problem - just because x,y are in Lambert projection coordinates doesn't mean you can't reshape z. -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449 325 Broadway Boulder, CO, USA 80305-3328
hi all, is there a way to plot (contourf) a .grd file from GMT directly with Basema= p?=20 I have a problem with contourf because I can't reshape to 2D the Z values ,= x=20 and y are in Lambert projection, so I can't compute the shape :-( thanks =2D-=20 Lionel Roubeyrie - lro...@li... Chag=C3=A9 d'=C3=A9tudes et de maintenance LIMAIR - la Surveillance de l'Air en Limousin http://www.limair.asso.fr
James Boyle wrote: > Eric, > Thanks for the quick reply. > I should have looked more closely at the examples for the contourf > solution. > As I indicated, my problem is a bit beyond contours. I have routines > that fill polygons ( finite element mesh) using a specified color map. > The ability to fill areas with the proper color is easy - getting the > corresponding color bar has been the more interesting part. > It is going to take some time to look over your suggestion to see how I > could implement it in my application. > Presently I sub-class scalarMappable, and set the appropriate values and > pass this to colorbar(). However, I have not been able to figure out how > to do this for non-uniform intervals. > This is a long winded way of saying that getting pcolor and matshow to > work may or may not solve my specific problem. I think that something close to my example should do the job. It sounds like your difficulty is with the colorbar; but colorbar gives quite a bit of control via the kwargs, and you can also drop back from colorbar.Colorbar (which the pylab colorbar command uses) to colorbar.ColorbarBase, using the colorbar.Colorbar code as an example. I don't think you should need to use an intermediate ScalarMappable subclass, although this may be a perfectly good approach. Eric > > Thanks again, > > --Jim > > On Apr 18, 2007, at 1:52 AM, Eric Firing wrote: > >> James Boyle wrote: >>> I wish to make a color filled plot with the colors defined for >>> discrete, non-uniform intervals. Something like: >>> 0.0 -0.001 0.001-0.05 0.05-0.2 0.2-0.4 0.4-0.8 0.8-1.0 >>> red blue green magenta >>> yellow cyan >>> with the colorbar labeled appropriately. >>> I have seen discussions and solutions for discrete colors but not >>> for non-uniform intervals + discrete. >>> The last post I saw regarding this type of issue was august 2005 - >>> and a solution was not resolved at that time. >>> However, Eric has done a huge amount of work in the intervening time >>> and a smarter person than myself might have a solution now. >>> Note that I do not wish just to make contours - although that would >>> be good - but to have a general mapping code that joins allows the >>> color rmapping to be passed to colorbar. >>> maybe some sub-class of scalarMappable that could work. >> >> This is very easy for contourf, and is illustrated in the second >> figure made by examples/contourf_demo.py. For your case above, it >> would be something like >> >> levs = [0, 0.001, 0.05, 0.2, 0.4, 0.8, 1] >> colors = ['r', 'b', 'g', 'm', 'y', 'c'] >> contourf(z, levs, colors=colors) >> colorbar() >> >> Unfortunately, although it *should* be just as easy for imshow or >> pcolor, it is not at present; it can be done, probably in several >> ways, but not in such a transparent way. Attached is a quick attempt >> at something that might be close to what you need. The right way to >> do this is to make some changes and additions to colors.py and >> colorbar.py; I might get to that in a few days, or, more likely, it >> might be a few weeks. >> >> Eric >> >>> Thanks for any help. >>> --Jim >> import pylab as P >> import numpy >> from matplotlib import colors >> >> class BoundaryNorm(colors.Normalize): >> def __init__(self, boundaries): >> self.vmin = boundaries[0] >> self.vmax = boundaries[-1] >> self.boundaries = boundaries >> self.N = len(self.boundaries) >> >> def __call__(self, x, clip=False): >> x = numpy.asarray(x) >> ret = numpy.zeros(x.shape, dtype=numpy.int) >> for i, b in enumerate(self.boundaries): >> ret[numpy.greater_equal(x, b)] = i >> ret[numpy.less(x, self.vmin)] = -1 >> ret = numpy.ma.asarray(ret / float(self.N-1)) >> return ret >> >> bounds = [0, 0.1, 0.5, 1] >> cm = colors.ListedColormap(['r', 'g', 'b']) >> >> z = (numpy.arange(5)[:,None] * >> numpy.arange(8)[None,:]).astype(numpy.float) >> z = z / z.max() >> >> P.pcolor(z, cmap=cm, norm=BoundaryNorm(bounds)) >> P.colorbar(boundaries=bounds) >> P.show()
Greetings, I have a 3d plot and, in the 'walls' of the plot, I need to plot some 2d functions to represent the projections of the 3d function. Is there any way to do or emulate that? The functions are actually very simple, so a work around might do the job. Also, is there a way to change the plot color? I tried using the 'color' keyword, but that didn't work. And I can't work well with the ticks. These two aren't really that important for what I need the plot, but any idea could help. =2D-=20 Jos=E9 Alexandre Nalon na...@te...
Eric, Thanks for the quick reply. I should have looked more closely at the examples for the contourf solution. As I indicated, my problem is a bit beyond contours. I have routines that fill polygons ( finite element mesh) using a specified color map. The ability to fill areas with the proper color is easy - getting the corresponding color bar has been the more interesting part. It is going to take some time to look over your suggestion to see how I could implement it in my application. Presently I sub-class scalarMappable, and set the appropriate values and pass this to colorbar(). However, I have not been able to figure out how to do this for non-uniform intervals. This is a long winded way of saying that getting pcolor and matshow to work may or may not solve my specific problem. Thanks again, --Jim On Apr 18, 2007, at 1:52 AM, Eric Firing wrote: > James Boyle wrote: >> I wish to make a color filled plot with the colors defined for >> discrete, non-uniform intervals. Something like: >> 0.0 -0.001 0.001-0.05 0.05-0.2 0.2-0.4 0.4-0.8 >> 0.8-1.0 >> red blue green magenta >> yellow cyan >> with the colorbar labeled appropriately. >> I have seen discussions and solutions for discrete colors but not >> for non-uniform intervals + discrete. >> The last post I saw regarding this type of issue was august 2005 >> - and a solution was not resolved at that time. >> However, Eric has done a huge amount of work in the intervening >> time and a smarter person than myself might have a solution now. >> Note that I do not wish just to make contours - although that >> would be good - but to have a general mapping code that joins >> allows the color rmapping to be passed to colorbar. >> maybe some sub-class of scalarMappable that could work. > > This is very easy for contourf, and is illustrated in the second > figure made by examples/contourf_demo.py. For your case above, it > would be something like > > levs = [0, 0.001, 0.05, 0.2, 0.4, 0.8, 1] > colors = ['r', 'b', 'g', 'm', 'y', 'c'] > contourf(z, levs, colors=colors) > colorbar() > > Unfortunately, although it *should* be just as easy for imshow or > pcolor, it is not at present; it can be done, probably in several > ways, but not in such a transparent way. Attached is a quick > attempt at something that might be close to what you need. The > right way to do this is to make some changes and additions to > colors.py and colorbar.py; I might get to that in a few days, or, > more likely, it might be a few weeks. > > Eric > >> Thanks for any help. >> --Jim > import pylab as P > import numpy > from matplotlib import colors > > class BoundaryNorm(colors.Normalize): > def __init__(self, boundaries): > self.vmin = boundaries[0] > self.vmax = boundaries[-1] > self.boundaries = boundaries > self.N = len(self.boundaries) > > def __call__(self, x, clip=False): > x = numpy.asarray(x) > ret = numpy.zeros(x.shape, dtype=numpy.int) > for i, b in enumerate(self.boundaries): > ret[numpy.greater_equal(x, b)] = i > ret[numpy.less(x, self.vmin)] = -1 > ret = numpy.ma.asarray(ret / float(self.N-1)) > return ret > > bounds = [0, 0.1, 0.5, 1] > cm = colors.ListedColormap(['r', 'g', 'b']) > > z = (numpy.arange(5)[:,None] * numpy.arange(8)[None,:]).astype > (numpy.float) > z = z / z.max() > > P.pcolor(z, cmap=cm, norm=BoundaryNorm(bounds)) > P.colorbar(boundaries=bounds) > P.show()
Christopher Barker wrote: > > ednspace wrote: >> I'm using WXpython and the OO api of matplotlib. > > Have you tried wxAgg? if nothing else, it should look better. It would > be interesting to see if it behaves differently as far as memory is > concerned. > > Also, be sure to post your versions and platform. > > switched matplotlib.use('WX') matplotlib.use('WXAgg') not sure if I need to change anything else in my code to use WXAgg everything looked the same to me, memory just keeps creeping up. is there something that needs to be done to clear the: self.lines[0].set_data(self.x,self.y) That I am setting with: self.lines = a.plot(self.x,self.y,'-') I am confused about what exactly self.lines ends up being, I mean self.lines[0] makes it seem like an array, however the assignment of the a.plot does not seem like one. thanks for the clues Versions Python 2.4.3 2.6.15-28-386 (Ubuntu Linux) Matplotlib 0.82 Numpy 1.0 -- View this message in context: http://www.nabble.com/WX-dynamic-plot-slowly-fills-memory-tf3590828.html#a10058901 Sent from the matplotlib - users mailing list archive at Nabble.com.
On 4/18/07, Eric Firing <ef...@ha...> wrote: > Bill Baxter wrote: > > There are a couple things about legend that I'm finding a little > > irksome. Is there some better way to do this? > > > > 1) if you have a contour, legend() wants to add all the contours to > > the list. calling contour(...,label='_nolegend_') doesn't seem to > > help. > > I think it would be quite unusual that someone would want contour lines > to show up in a legend, so I made the change I suggested in an earlier > response to this thread: the LineCollections in the ContourSet now have > their labels set to _nolegend_. If someone really does want contour > lines in a legend, these labels still can be changed manually, as > described earlier in this thread. You can also use colorbar() to show the levels if you want that information to be visible, and that's probably more appropriate than a legend anyway. I think it's a good change. Thanks! --bb