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
(35) |
2
(15) |
3
(16) |
4
(3) |
5
(1) |
6
(1) |
7
(11) |
8
(10) |
9
(13) |
10
(24) |
11
(21) |
12
(10) |
13
(2) |
14
(24) |
15
(20) |
16
(36) |
17
(13) |
18
(6) |
19
(4) |
20
(2) |
21
(11) |
22
(13) |
23
(7) |
24
(10) |
25
(7) |
26
(12) |
27
(2) |
28
(6) |
29
(20) |
30
(9) |
31
(39) |
|
|
Hi Lubos, Lubos Vrbka wrote: >> 1. Would it be possible to do only shallow copy of the arrays that are >> being plotted so that on redrawing the figure, chanes in the datasets >> would be picked up automatically? If not, is Line2D.set_data(...) the >> right approach? >> > isn't this the way how the plotting is done? in my experience (iirc), > the following thing works (x, y1, y2 are numpy arrays): > > pylab.ion() > > a, = pylab.plot(x,y1) > b, = pylab.plot(x,y2) > ... > y1 += 10 > y2 += 20 > > a.set_ydata(y1) > b.set_ydata(y2) > pylab.draw() > > y1 += 10 > y2 += 20 > a.set_ydata(y1) > pylab.draw() > > in my experience BOTH plots get updated in this procedure, so i have to > do first a deep copy in my case to get rid of these 'unwanted effects'... > If I understand correctly the len of X and Y will be changing, therefore you may have to use set_data() function of Line2D set_data(self, *args) Set the x and y data ACCEPTS: (array xdata, array ydata) I seem to remember getting a size mismatch if X and Y grew in length and I tried to use set_xdata() or set_ydata() separately. YMMV Steve
Hi, Try mylines = plot1.get_lines() plot2.legend(mylines, [p.get_label() for p in mylines]) When you call the legend method with two arguments, first argument is a list of lines and second argument is a list of labels. It does not seem to matter whether lines are from same axes. Hope this helps. -JJ On Mon, Jul 14, 2008 at 12:47 PM, David Lonie <lon...@gm...> wrote: > I have an application that has 2 subplots, and I'd like to use the second to > display the legend for the first. For example, for subplots plot1 and plot2: > > plot1.plot((1,2,3,4), label='up', color = 'g') > plot1.plot((4,3,2,1), label='down', color = 'b') > > plot2.legend("What can I put here to display a legend for plot1 on > plot2???") > > Can this be done? > > Thanks, > > Dave > ------------------------------------------------------------------------- > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > Studies have shown that voting for your favorite open source project, > along with a healthy diet, reduces your potential for chronic lameness > and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > >
On Mon, Jul 14, 2008 at 3:05 PM, Michael Droettboom <md...@st...> wrote: > I can confirm this. > > Commenting out "del Gcf.figs[num]" in Gcf.destroy (in _pylab_helpers.py) > also seems to resolve the leak. But I have no idea why, so I won't > commit it just yet. I don't have much time to look deeper now. Does > anyone (who probably understands figure management better than me) have > an idea what might cause this? Can you post the script you are using to test -- I am a little confused from reading this thread by whether or not twinx is implicated. Also, I saw that you committed some changes vis-a-vis the twinx leak r5747 | mdboom | 2008年07月11日 13:21:53 -0500 (2008年7月11日) | 2 lines Fix memory leak when using shared axes. so I thought that part was resolved already... JDH
I can confirm this. Commenting out "del Gcf.figs[num]" in Gcf.destroy (in _pylab_helpers.py) also seems to resolve the leak. But I have no idea why, so I won't commit it just yet. I don't have much time to look deeper now. Does anyone (who probably understands figure management better than me) have an idea what might cause this? Cheers, Mike Manuel Metz wrote: > Michael Droettboom wrote: >> Which backend? > > GTK, GTKAgg, TK, but not with any backend without a window: Agg, > Cairo, PS, PDF, SVG ... > > Cheers, > Manuel > >> Cheers, >> Mike >> >> Manuel Metz wrote: >>> Michael Droettboom wrote: >>>> Thanks for the report. So we can diagnose this, what version of >>>> matplotlib are you reporting this for? >>>> >>>> Also, you may be interested in the following FAQ (and the one >>>> following it): >>>> >>>> http://matplotlib.sourceforge.net/faq.html#LEAKS >>> >>> Hi, >>> >>> I tested this with the lastest svn, and I do also see a leak. But >>> it's not related to twinx, but to pylab.close(). If I just comment >>> out this one line, the memleak disappears ... >>> >>> Manuel >>> >>>> Cheers, >>>> Mike >>>> >>>> laurent oget wrote: >>>>> i forgot two imports. >>>>> >>>>> import math >>>>> import gc >>>>> import pylab as PL >>>>> >>>>> >>>>> def looptest(): >>>>> while(1): >>>>> fig=PL.figure(1) >>>>> ax=fig.add_subplot(211) >>>>> ax.set_position((0,0,0.9,0.45)) >>>>> ax1=PL.twinx(ax) >>>>> t=range(1000) >>>>> st=[math.sin(x*0.01) for x in t] >>>>> ax.plot(t,st) >>>>> fig.clf() >>>>> PL.close(1) >>>>> gc.collect() >>>>> print "GC" >>>>> print len(gc.get_objects()) >>>>> print len(gc.garbage) >>>>> looptest() >>>>> 2008年7月11日 laurent oget <la...@og... <mailto:la...@og...>>: >>>>> >>>>> I think i narrowed down the memory leak i have been chasing for a >>>>> while. >>>>> If i remove the call to twinx i get a slow leak, which would >>>>> cause >>>>> me trouble >>>>> after a very long time. With the call to twinx, however i am >>>>> losing thousands of objects >>>>> at each loop. >>>>> >>>>> Thanks, >>>>> >>>>> Laurent >>>>> >>>>> >>>>> >>>>>>>>>>>>>>>>>>>>>>>>> import pylab as PL >>>>> def looptest(): >>>>> while(1): >>>>> fig=PL.figure(1) >>>>> ax=fig.add_subplot(211) >>>>> ax.set_position((0,0,0.9,0.45)) >>>>> ax1=PL.twinx(ax) >>>>> t=range(1000) >>>>> st=[math.sin(x*0.01) for x in t] >>>>> ax.plot(t,st) >>>>> fig.clf() >>>>> PL.close(1) >>>>> gc.collect() >>>>> print "GC" >>>>> print len(gc.get_objects()) >>>>> print len(gc.garbage) >>>>> looptest() >>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>> >>>>> >>>>> ------------------------------------------------------------------------ >>>>> >>>>> >>>>> ------------------------------------------------------------------------- >>>>> >>>>> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! >>>>> Studies have shown that voting for your favorite open source project, >>>>> along with a healthy diet, reduces your potential for chronic >>>>> lameness >>>>> and boredom. Vote Now at http://www.sourceforge.net/community/cca08 >>>>> ------------------------------------------------------------------------ >>>>> >>>>> >>>>> _______________________________________________ >>>>> 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
Michael Droettboom wrote: > Which backend? GTK, GTKAgg, TK, but not with any backend without a window: Agg, Cairo, PS, PDF, SVG ... Cheers, Manuel > Cheers, > Mike > > Manuel Metz wrote: >> Michael Droettboom wrote: >>> Thanks for the report. So we can diagnose this, what version of >>> matplotlib are you reporting this for? >>> >>> Also, you may be interested in the following FAQ (and the one >>> following it): >>> >>> http://matplotlib.sourceforge.net/faq.html#LEAKS >> >> Hi, >> >> I tested this with the lastest svn, and I do also see a leak. But >> it's not related to twinx, but to pylab.close(). If I just comment out >> this one line, the memleak disappears ... >> >> Manuel >> >>> Cheers, >>> Mike >>> >>> laurent oget wrote: >>>> i forgot two imports. >>>> >>>> import math >>>> import gc >>>> import pylab as PL >>>> >>>> >>>> def looptest(): >>>> while(1): >>>> fig=PL.figure(1) >>>> ax=fig.add_subplot(211) >>>> ax.set_position((0,0,0.9,0.45)) >>>> ax1=PL.twinx(ax) >>>> t=range(1000) >>>> st=[math.sin(x*0.01) for x in t] >>>> ax.plot(t,st) >>>> fig.clf() >>>> PL.close(1) >>>> gc.collect() >>>> print "GC" >>>> print len(gc.get_objects()) >>>> print len(gc.garbage) >>>> looptest() >>>> 2008年7月11日 laurent oget <la...@og... <mailto:la...@og...>>: >>>> >>>> I think i narrowed down the memory leak i have been chasing for a >>>> while. >>>> If i remove the call to twinx i get a slow leak, which would cause >>>> me trouble >>>> after a very long time. With the call to twinx, however i am >>>> losing thousands of objects >>>> at each loop. >>>> >>>> Thanks, >>>> >>>> Laurent >>>> >>>> >>>> >>>>>>>>>>>>>>>>>>>>>>>>> import pylab as PL >>>> def looptest(): >>>> while(1): >>>> fig=PL.figure(1) >>>> ax=fig.add_subplot(211) >>>> ax.set_position((0,0,0.9,0.45)) >>>> ax1=PL.twinx(ax) >>>> t=range(1000) >>>> st=[math.sin(x*0.01) for x in t] >>>> ax.plot(t,st) >>>> fig.clf() >>>> PL.close(1) >>>> gc.collect() >>>> print "GC" >>>> print len(gc.get_objects()) >>>> print len(gc.garbage) >>>> looptest() >>>> >>>>>>>>>>>>>>>>>>>>>>>>>>> >>>> >>>> >>>> ------------------------------------------------------------------------ >>>> >>>> >>>> ------------------------------------------------------------------------- >>>> >>>> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! >>>> Studies have shown that voting for your favorite open source project, >>>> along with a healthy diet, reduces your potential for chronic lameness >>>> and boredom. Vote Now at http://www.sourceforge.net/community/cca08 >>>> ------------------------------------------------------------------------ >>>> >>>> >>>> _______________________________________________ >>>> Matplotlib-users mailing list >>>> Mat...@li... >>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>>> >>> >> >
Which backend? Cheers, Mike Manuel Metz wrote: > Michael Droettboom wrote: >> Thanks for the report. So we can diagnose this, what version of >> matplotlib are you reporting this for? >> >> Also, you may be interested in the following FAQ (and the one >> following it): >> >> http://matplotlib.sourceforge.net/faq.html#LEAKS > > Hi, > > I tested this with the lastest svn, and I do also see a leak. But > it's not related to twinx, but to pylab.close(). If I just comment out > this one line, the memleak disappears ... > > Manuel > >> Cheers, >> Mike >> >> laurent oget wrote: >>> i forgot two imports. >>> >>> import math >>> import gc >>> import pylab as PL >>> >>> >>> def looptest(): >>> while(1): >>> fig=PL.figure(1) >>> ax=fig.add_subplot(211) >>> ax.set_position((0,0,0.9,0.45)) >>> ax1=PL.twinx(ax) >>> t=range(1000) >>> st=[math.sin(x*0.01) for x in t] >>> ax.plot(t,st) >>> fig.clf() >>> PL.close(1) >>> gc.collect() >>> print "GC" >>> print len(gc.get_objects()) >>> print len(gc.garbage) >>> looptest() >>> 2008年7月11日 laurent oget <la...@og... <mailto:la...@og...>>: >>> >>> I think i narrowed down the memory leak i have been chasing for a >>> while. >>> If i remove the call to twinx i get a slow leak, which would cause >>> me trouble >>> after a very long time. With the call to twinx, however i am >>> losing thousands of objects >>> at each loop. >>> >>> Thanks, >>> >>> Laurent >>> >>> >>> >>>>>>>>>>>>>>>>>>>>>>>>> import pylab as PL >>> def looptest(): >>> while(1): >>> fig=PL.figure(1) >>> ax=fig.add_subplot(211) >>> ax.set_position((0,0,0.9,0.45)) >>> ax1=PL.twinx(ax) >>> t=range(1000) >>> st=[math.sin(x*0.01) for x in t] >>> ax.plot(t,st) >>> fig.clf() >>> PL.close(1) >>> gc.collect() >>> print "GC" >>> print len(gc.get_objects()) >>> print len(gc.garbage) >>> looptest() >>> >>>>>>>>>>>>>>>>>>>>>>>>>>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> >>> ------------------------------------------------------------------------- >>> >>> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! >>> Studies have shown that voting for your favorite open source project, >>> along with a healthy diet, reduces your potential for chronic lameness >>> and boredom. Vote Now at http://www.sourceforge.net/community/cca08 >>> ------------------------------------------------------------------------ >>> >>> >>> _______________________________________________ >>> 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
Michael Droettboom wrote: > Thanks for the report. So we can diagnose this, what version of > matplotlib are you reporting this for? > > Also, you may be interested in the following FAQ (and the one following it): > > http://matplotlib.sourceforge.net/faq.html#LEAKS Hi, I tested this with the lastest svn, and I do also see a leak. But it's not related to twinx, but to pylab.close(). If I just comment out this one line, the memleak disappears ... Manuel > Cheers, > Mike > > laurent oget wrote: >> i forgot two imports. >> >> import math >> import gc >> import pylab as PL >> >> >> def looptest(): >> while(1): >> fig=PL.figure(1) >> ax=fig.add_subplot(211) >> ax.set_position((0,0,0.9,0.45)) >> ax1=PL.twinx(ax) >> t=range(1000) >> st=[math.sin(x*0.01) for x in t] >> ax.plot(t,st) >> fig.clf() >> PL.close(1) >> gc.collect() >> print "GC" >> print len(gc.get_objects()) >> print len(gc.garbage) >> looptest() >> 2008年7月11日 laurent oget <la...@og... <mailto:la...@og...>>: >> >> I think i narrowed down the memory leak i have been chasing for a >> while. >> If i remove the call to twinx i get a slow leak, which would cause >> me trouble >> after a very long time. With the call to twinx, however i am >> losing thousands of objects >> at each loop. >> >> Thanks, >> >> Laurent >> >> >> >>>>>>>>>>>>>>>>>>>>>>>>> >> import pylab as PL >> def looptest(): >> while(1): >> fig=PL.figure(1) >> ax=fig.add_subplot(211) >> ax.set_position((0,0,0.9,0.45)) >> ax1=PL.twinx(ax) >> t=range(1000) >> st=[math.sin(x*0.01) for x in t] >> ax.plot(t,st) >> fig.clf() >> PL.close(1) >> gc.collect() >> print "GC" >> print len(gc.get_objects()) >> print len(gc.garbage) >> looptest() >> >>>>>>>>>>>>>>>>>>>>>>>>>>> >> >> >> ------------------------------------------------------------------------ >> >> ------------------------------------------------------------------------- >> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! >> Studies have shown that voting for your favorite open source project, >> along with a healthy diet, reduces your potential for chronic lameness >> and boredom. Vote Now at http://www.sourceforge.net/community/cca08 >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >
Hello Jeff, > Timme: Here's one way to do it many thanks so far. I still have to inspect and improve my script. But at least your code lead me to some contourd surface. I will come back and tell if it worked. Unfortunately I cannot disclose the data nor the results because of copyright issues. So this mail is just to thank you for your responsiveness to my questions. Timmie
I have an application that has 2 subplots, and I'd like to use the second to display the legend for the first. For example, for subplots plot1 and plot2: plot1.plot((1,2,3,4), label='up', color = 'g') plot1.plot((4,3,2,1), label='down', color = 'b') plot2.legend("What can I put here to display a legend for plot1 on plot2???") Can this be done? Thanks, Dave
Tim Michelsen wrote: > Hello, > thanks. > I checked again from contour_demo.py of the basemap distribution. > > There lats, lons are uniquely monoton increasing from 0-360 and from -90 to 90. > In my case data is written row-by-row: > * increasing from lowest latitude western most longitude to easternmost > longitude and then increasing each rows in the same manner to the northermost > latitude (see below). > > So, as you said, it's a question of re-aranging the data. that it fits the to > the way m.contour expects the 2-D array. > Also, since the grid is still coarse, I would need to apply some smoothing > afterwards. What do you recommend for that? > Timme: Here's one way to do it from matplotlib.mlab import load import matplotlib.pyplot as plt import numpy as np data = load("data.txt") # need to know nlons and nlats beforehand! nlons = 8; nlats = 25 X = data[0::nlats,0] Y = data[0:nlats,1] # data is in nlons,nlats order in file, need to transpose Z = data[:,2].reshape(nlons,nlats).transpose() X,Y = np.meshgrid(X,Y) CS = plt.contourf(X,Y,Z,20) plt.show() I don't have any recommendations for smoothing - why don't you plot the raw data first and see if you really need it? > I don't know how I can do this easily by hand. May you give me some guidance > here, please? > > But I may just convert it to a shape file using GIS then load it with the > shapefile interface you wrote. > What would you see as most convenient way? > If I produce maps with a GIS but want to use matplotlib for the map plotting, > what would be the preferred export format? Any gdal format? > I prefer netCDF format for gridded data (basemap contains a function for reading netCDF files - NetCDFFile). -Jeff > Many thanks in advance, > Timmie > > ### data example > > Latitude Longitude value > 45 7 7.65251434 > 45 7.25 6.841345477 > 45 7.5 3.923153289 > 45 7.75 3.644313708 > 45 8 3.550977951 > 45 8.25 3.352525137 > 45 8.5 3.080082094 > 45 8.75 2.971992657 > 45 9 2.998723785 > 45 9.25 3.080082094 > 45 9.5 3.185687405 > 45 9.75 3.102075854 > 45 10 3.185687405 > 45 10.25 3.213960325 > 45 10.5 3.32326373 > 45 10.75 3.465643983 > 45 11 3.612980369 > 45 11.25 3.644313708 > 45 11.5 3.701277511 > 45 11.75 3.923153289 > 45 12 3.797848342 > 45 12.25 3.612980369 > 45 12.5 3.435577844 > 45 12.75 3.294210812 > 45 13 3.26536503 > 45.25 7 6.485050223 > 45.25 7.25 6.343081631 > 45.25 7.5 3.856783573 > 45.25 7.75 3.405725407 > 45.25 8 3.550977951 > 45.25 8.25 3.294210812 > 45.25 8.5 3.294210812 > 45.25 8.75 3.185687405 > 45.25 9 3.15761656 > 45.25 9.25 3.213960325 > 45.25 9.5 3.15761656 > 45.25 9.75 3.32326373 > 45.25 10 3.405725407 > 45.25 10.25 3.495925216 > 45.25 10.5 3.465643983 > 45.25 10.75 3.550977951 > 45.25 11 3.465643983 > 45.25 11.25 3.765429652 > 45.25 11.5 3.95669157 > 45.25 11.75 3.797848342 > 45.25 12 3.923153289 > 45.25 12.25 3.733239867 > 45.25 12.5 3.550977951 > 45.25 12.75 3.520306012 > 45.25 13 3.376085288 > 45.5 7 6.383367092 > 45.5 7.25 6.383367092 > 45.5 7.5 6.009422688 > 45.5 7.75 4.679469855 > 45.5 8 3.435577844 > 45.5 8.25 3.435577844 > 45.5 8.5 3.236725042 > 45.5 8.75 3.236725042 > 45.5 9 3.185687405 > 45.5 9.25 3.102075854 > 45.5 9.5 3.102075854 > 45.5 9.75 3.185687405 > 45.5 10 3.352525137 > 45.5 10.25 3.405725407 > 45.5 10.5 3.376085288 > 45.5 10.75 3.612980369 > 45.5 11 3.520306012 > 45.5 11.25 3.352525137 > 45.5 11.5 3.823949103 > 45.5 11.75 3.856783573 > 45.5 12 3.856783573 > 45.5 12.25 3.765429652 > 45.5 12.5 3.669541114 > 45.5 12.75 3.550977951 > 45.5 13 3.435577844 > 45.75 7 5.309043916 > 45.75 7.25 6.057519881 > 45.75 7.5 5.030958443 > 45.75 7.75 4.836570243 > 45.75 8 4.836570243 > 45.75 8.25 2.724965001 > 45.75 8.5 2.607751091 > 45.75 8.75 3.26536503 > 45.75 9 2.898163214 > 45.75 9.25 2.872155245 > 45.75 9.5 1.893252754 > 45.75 9.75 2.043669061 > 45.75 10 1.75488883 > 45.75 10.25 2.004264146 > 45.75 10.5 2.971992657 > 45.75 10.75 1.804949998 > 45.75 11 2.846334614 > 45.75 11.25 5.519419657 > 45.75 11.5 2.517818813 > 45.75 11.75 3.733239867 > 45.75 12 3.376085288 > 45.75 12.25 3.550977951 > 45.75 12.5 3.612980369 > 45.75 12.75 3.520306012 > 45.75 13 3.495925216 > 46 7 5.06399168 > 46 7.25 4.949174095 > 46 7.5 5.266087828 > 46 7.75 5.352298328 > 46 8 4.757472437 > 46 8.25 2.800325674 > 46 8.5 3.612980369 > 46 8.75 3.185687405 > 46 9 2.323282473 > 46 9.25 1.671485743 > 46 9.5 3.856783573 > 46 9.75 4.572079662 > 46 10 4.679469855 > 46 10.25 4.679469855 > 46 10.5 5.309043916 > 46 10.75 3.294210812 > 46 11 3.405725407 > 46 11.25 3.669541114 > 46 11.5 3.495925216 > 46 11.75 4.255093726 > 46 12 3.495925216 > 46 12.25 3.185687405 > 46 12.5 3.213960325 > 46 12.75 3.550977951 > 46 13 3.520306012 > 46.25 7 1.969297411 > 46.25 7.25 4.908706364 > 46.25 7.5 3.052767233 > 46.25 7.75 3.765429652 > 46.25 8 3.95669157 > 46.25 8.25 5.06399168 > 46.25 8.5 5.266087828 > 46.25 8.75 3.669541114 > 46.25 9 3.185687405 > 46.25 9.25 3.797848342 > 46.25 9.5 3.352525137 > 46.25 9.75 5.439709782 > 46.25 10 5.69098301 > 46.25 10.25 4.949174095 > 46.25 10.5 5.736883145 > 46.25 10.75 5.105542055 > 46.25 11 4.255093726 > 46.25 11.25 3.701277511 > 46.25 11.5 4.255093726 > 46.25 11.75 4.572079662 > 46.25 12 3.98369323 > 46.25 12.25 4.148941623 > 46.25 12.5 3.129746478 > 46.25 12.75 3.236725042 > 46.25 13 3.550977951 > 46.5 7 2.872155245 > 46.5 7.25 3.701277511 > 46.5 7.5 3.15761656 > 46.5 7.75 3.765429652 > 46.5 8 5.18951259 > 46.5 8.25 6.105948261 > 46.5 8.5 5.266087828 > 46.5 8.75 5.69098301 > 46.5 9 6.009422688 > 46.5 9.25 5.147381739 > 46.5 9.5 5.829636932 > 46.5 9.75 5.654489904 > 46.5 10 6.243327668 > 46.5 10.25 5.395852976 > 46.5 10.5 5.736883145 > 46.5 10.75 6.057519881 > 46.5 11 5.147381739 > 46.5 11.25 3.520306012 > 46.5 11.5 3.856783573 > 46.5 11.75 4.148941623 > 46.5 12 4.71833512 > 46.5 12.25 4.71833512 > 46.5 12.5 3.701277511 > 46.5 12.75 3.889851131 > 46.5 13 3.32326373 > 46.75 7 1.859766825 > 46.75 7.25 2.198852355 > 46.75 7.5 2.345277833 > 46.75 7.75 2.517818813 > 46.75 8 3.856783573 > 46.75 8.25 3.856783573 > 46.75 8.5 5.06399168 > 46.75 8.75 4.184077131 > 46.75 9 5.829636932 > 46.75 9.25 3.644313708 > 46.75 9.5 3.765429652 > 46.75 9.75 5.309043916 > 46.75 10 6.009422688 > 46.75 10.25 5.147381739 > 46.75 10.5 5.609155594 > 46.75 10.75 5.783100444 > 46.75 11 5.147381739 > 46.75 11.25 3.581868928 > 46.75 11.5 4.908706364 > 46.75 11.75 3.465643983 > 46.75 12 3.465643983 > 46.75 12.25 4.148941623 > 46.75 12.5 3.98369323 > 46.75 12.75 3.581868928 > 46.75 13 3.644313708 > > > ------------------------------------------------------------------------- > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > Studies have shown that voting for your favorite open source project, > along with a healthy diet, reduces your potential for chronic lameness > and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- 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-113 Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
On Mon, Jul 14, 2008 at 9:49 AM, Ben Axelrod <bax...@co...> wrote: > The RectangleSelector has parameters for the min span in the x and y > directions of the rectangle. The units of these are the axes units. It > would be nice if there was an additional similar min size requirement, but > in units of pixels. This way it would be independent of the axes scale. Good idea -- I added this to svn r5769. Here is some example usage: LS = RectangleSelector(current_ax, line_select_callback, drawtype='box',useblit=True, minspanx=5,minspany=5,spancoords='pixels')
Hello, thanks. I checked again from contour_demo.py of the basemap distribution. There lats, lons are uniquely monoton increasing from 0-360 and from -90 to 90. In my case data is written row-by-row: * increasing from lowest latitude western most longitude to easternmost longitude and then increasing each rows in the same manner to the northermost latitude (see below). So, as you said, it's a question of re-aranging the data. that it fits the to the way m.contour expects the 2-D array. Also, since the grid is still coarse, I would need to apply some smoothing afterwards. What do you recommend for that? I don't know how I can do this easily by hand. May you give me some guidance here, please? But I may just convert it to a shape file using GIS then load it with the shapefile interface you wrote. What would you see as most convenient way? If I produce maps with a GIS but want to use matplotlib for the map plotting, what would be the preferred export format? Any gdal format? Many thanks in advance, Timmie ### data example Latitude Longitude value 45 7 7.65251434 45 7.25 6.841345477 45 7.5 3.923153289 45 7.75 3.644313708 45 8 3.550977951 45 8.25 3.352525137 45 8.5 3.080082094 45 8.75 2.971992657 45 9 2.998723785 45 9.25 3.080082094 45 9.5 3.185687405 45 9.75 3.102075854 45 10 3.185687405 45 10.25 3.213960325 45 10.5 3.32326373 45 10.75 3.465643983 45 11 3.612980369 45 11.25 3.644313708 45 11.5 3.701277511 45 11.75 3.923153289 45 12 3.797848342 45 12.25 3.612980369 45 12.5 3.435577844 45 12.75 3.294210812 45 13 3.26536503 45.25 7 6.485050223 45.25 7.25 6.343081631 45.25 7.5 3.856783573 45.25 7.75 3.405725407 45.25 8 3.550977951 45.25 8.25 3.294210812 45.25 8.5 3.294210812 45.25 8.75 3.185687405 45.25 9 3.15761656 45.25 9.25 3.213960325 45.25 9.5 3.15761656 45.25 9.75 3.32326373 45.25 10 3.405725407 45.25 10.25 3.495925216 45.25 10.5 3.465643983 45.25 10.75 3.550977951 45.25 11 3.465643983 45.25 11.25 3.765429652 45.25 11.5 3.95669157 45.25 11.75 3.797848342 45.25 12 3.923153289 45.25 12.25 3.733239867 45.25 12.5 3.550977951 45.25 12.75 3.520306012 45.25 13 3.376085288 45.5 7 6.383367092 45.5 7.25 6.383367092 45.5 7.5 6.009422688 45.5 7.75 4.679469855 45.5 8 3.435577844 45.5 8.25 3.435577844 45.5 8.5 3.236725042 45.5 8.75 3.236725042 45.5 9 3.185687405 45.5 9.25 3.102075854 45.5 9.5 3.102075854 45.5 9.75 3.185687405 45.5 10 3.352525137 45.5 10.25 3.405725407 45.5 10.5 3.376085288 45.5 10.75 3.612980369 45.5 11 3.520306012 45.5 11.25 3.352525137 45.5 11.5 3.823949103 45.5 11.75 3.856783573 45.5 12 3.856783573 45.5 12.25 3.765429652 45.5 12.5 3.669541114 45.5 12.75 3.550977951 45.5 13 3.435577844 45.75 7 5.309043916 45.75 7.25 6.057519881 45.75 7.5 5.030958443 45.75 7.75 4.836570243 45.75 8 4.836570243 45.75 8.25 2.724965001 45.75 8.5 2.607751091 45.75 8.75 3.26536503 45.75 9 2.898163214 45.75 9.25 2.872155245 45.75 9.5 1.893252754 45.75 9.75 2.043669061 45.75 10 1.75488883 45.75 10.25 2.004264146 45.75 10.5 2.971992657 45.75 10.75 1.804949998 45.75 11 2.846334614 45.75 11.25 5.519419657 45.75 11.5 2.517818813 45.75 11.75 3.733239867 45.75 12 3.376085288 45.75 12.25 3.550977951 45.75 12.5 3.612980369 45.75 12.75 3.520306012 45.75 13 3.495925216 46 7 5.06399168 46 7.25 4.949174095 46 7.5 5.266087828 46 7.75 5.352298328 46 8 4.757472437 46 8.25 2.800325674 46 8.5 3.612980369 46 8.75 3.185687405 46 9 2.323282473 46 9.25 1.671485743 46 9.5 3.856783573 46 9.75 4.572079662 46 10 4.679469855 46 10.25 4.679469855 46 10.5 5.309043916 46 10.75 3.294210812 46 11 3.405725407 46 11.25 3.669541114 46 11.5 3.495925216 46 11.75 4.255093726 46 12 3.495925216 46 12.25 3.185687405 46 12.5 3.213960325 46 12.75 3.550977951 46 13 3.520306012 46.25 7 1.969297411 46.25 7.25 4.908706364 46.25 7.5 3.052767233 46.25 7.75 3.765429652 46.25 8 3.95669157 46.25 8.25 5.06399168 46.25 8.5 5.266087828 46.25 8.75 3.669541114 46.25 9 3.185687405 46.25 9.25 3.797848342 46.25 9.5 3.352525137 46.25 9.75 5.439709782 46.25 10 5.69098301 46.25 10.25 4.949174095 46.25 10.5 5.736883145 46.25 10.75 5.105542055 46.25 11 4.255093726 46.25 11.25 3.701277511 46.25 11.5 4.255093726 46.25 11.75 4.572079662 46.25 12 3.98369323 46.25 12.25 4.148941623 46.25 12.5 3.129746478 46.25 12.75 3.236725042 46.25 13 3.550977951 46.5 7 2.872155245 46.5 7.25 3.701277511 46.5 7.5 3.15761656 46.5 7.75 3.765429652 46.5 8 5.18951259 46.5 8.25 6.105948261 46.5 8.5 5.266087828 46.5 8.75 5.69098301 46.5 9 6.009422688 46.5 9.25 5.147381739 46.5 9.5 5.829636932 46.5 9.75 5.654489904 46.5 10 6.243327668 46.5 10.25 5.395852976 46.5 10.5 5.736883145 46.5 10.75 6.057519881 46.5 11 5.147381739 46.5 11.25 3.520306012 46.5 11.5 3.856783573 46.5 11.75 4.148941623 46.5 12 4.71833512 46.5 12.25 4.71833512 46.5 12.5 3.701277511 46.5 12.75 3.889851131 46.5 13 3.32326373 46.75 7 1.859766825 46.75 7.25 2.198852355 46.75 7.5 2.345277833 46.75 7.75 2.517818813 46.75 8 3.856783573 46.75 8.25 3.856783573 46.75 8.5 5.06399168 46.75 8.75 4.184077131 46.75 9 5.829636932 46.75 9.25 3.644313708 46.75 9.5 3.765429652 46.75 9.75 5.309043916 46.75 10 6.009422688 46.75 10.25 5.147381739 46.75 10.5 5.609155594 46.75 10.75 5.783100444 46.75 11 5.147381739 46.75 11.25 3.581868928 46.75 11.5 4.908706364 46.75 11.75 3.465643983 46.75 12 3.465643983 46.75 12.25 4.148941623 46.75 12.5 3.98369323 46.75 12.75 3.581868928 46.75 13 3.644313708
The RectangleSelector has parameters for the min span in the x and y directions of the rectangle. The units of these are the axes units. It would be nice if there was an additional similar min size requirement, but in units of pixels. This way it would be independent of the axes scale. Thanks, -Ben
On Thu, Jul 10, 2008 at 6:42 AM, Angela Rivera Campos <riv...@in...> wrote: > Hi, > > I'm quite a newbie on matplotlib. > > I'm trying to get some data from a file. I've got a function that reads > the data from the file and stores it in a tuple as a set of floats. When > I use this without importing pylab it just go well but when I do it > after importing this module there's a rounding and I don't get the > proper data: My guess is there is something triggered by a pylab numpy/numerix/Numeric import, but w/o kjnowing more about your matplotlib and other software versions is it difficult to guess. Could you put these lines into a test script and run them with > python myscript.py --verbose-debug and paste the output. Florian Koelling recently reported a problem that sounded very similar under the heading "mad interference between matplotlib and openbabel". Apparently some pylab import is doing something funky with some third party libs. Could you test just the numpy imports to see if that makes a difference. Ie, instead of importing pylab before your module code, do the following: import numpy import numpy.fft importnumpy.random import numpy.linalg and let us know if you see similar problems. JDH JDH
Tim Michelsen wrote: > Hello Jeff, > > >>>> - Points stored in the above descripbed format (lat, lon, value)? >>>> > This one I solved using a m.scatter() function > > >>>> - Interpolate a grid of data points by using different interpolation >>>> methods like inverse distance wheighting, natural neighbor >>>> > interpolation, etc. to get a contour map? > >>> For interpolation of irregular, randomly distributed data points see >>> http://www.scipy.org/Cookbook/Matplotlib/ >>> > Gridding_irregularly_spaced_data. > >>> However, if there is some structure to the data grid then it's probably >>> better not to use these approaches. >>> > The problem is that although regular spaced the grid is still to large to > countour to a nice map. I will play a bit more with contour and other > interpolation functions. > > I tried griddata: > > >> 2) using the griddata package >> Here I was nearly without orientation how to call griddata correctly. >> > I tried again. > > Here is what I got: > x = data[:,1] > y = data[:,0] > z = data[:,2] > X, Y = mlab.meshgrid(x, y) > X, Z = mlab.meshgrid(x, y) > # zi = griddata(x,y,z,xi,yi,**kwargs) > Z = grid.griddata(x,y,z, X, Y) > plt.contour(X,Y, Z) > > => ValueError: output grid defined by xi,yi must be monotone increasing > > The coordinates are stored in a way that first longitude (x) increases and > then the latitude (y) increases. > 10 6.0 4 > 10 6.25 3 > 10 6.50 2 > 10 6.75 1 > 10 6.0 6 > 11 6.25 7 > 11 6.50 6 > 11 6.75 9 > 12 6.0 4 > > What how do I need to arrange my data to get it monotone increasing for > griddata? > > Thanks for your help. One settled I will send you another example for the > examples package. > > Kind regards, > Timmie > > Timmie: You shouldn't use griddata. You have a regular lat/lon grid, so it's just a matter of loading the data into the proper 2-d array. Please send a self-contained script (and post the data somewhere) and then we can help you. -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449 325 Broadway Boulder, CO, USA 80305-3328
Le lundi 14 juillet 2008 à 09:08 -0400, Michael Droettboom a écrit : > Do any other developers have better suggestions? We may have to do some > magic in at drawing time (or convince the autoscaler to ignore the stem > lines) -- but I'd like to find a way that minimizes additional complexity. > Is it possible do proceed as using axvline, i.e. specifying the axes coordinates? In this case, it would require a mix of data coordinate (the value to display) and of axes coordinate (the bottom of the curve). When would values to render be converted ? -- Fabrice Silva <si...@lm...> LMA UPR CNRS 7051 - équipe S2M
Hello Jeff, > >> - Points stored in the above descripbed format (lat, lon, value)? This one I solved using a m.scatter() function > >> - Interpolate a grid of data points by using different interpolation >>> methods like inverse distance wheighting, natural neighbor interpolation, etc. to get a contour map? > > For interpolation of irregular, randomly distributed data points see > > http://www.scipy.org/Cookbook/Matplotlib/ Gridding_irregularly_spaced_data. > > > > However, if there is some structure to the data grid then it's probably > > better not to use these approaches. The problem is that although regular spaced the grid is still to large to countour to a nice map. I will play a bit more with contour and other interpolation functions. I tried griddata: > 2) using the griddata package > Here I was nearly without orientation how to call griddata correctly. I tried again. Here is what I got: x = data[:,1] y = data[:,0] z = data[:,2] X, Y = mlab.meshgrid(x, y) X, Z = mlab.meshgrid(x, y) # zi = griddata(x,y,z,xi,yi,**kwargs) Z = grid.griddata(x,y,z, X, Y) plt.contour(X,Y, Z) => ValueError: output grid defined by xi,yi must be monotone increasing The coordinates are stored in a way that first longitude (x) increases and then the latitude (y) increases. 10 6.0 4 10 6.25 3 10 6.50 2 10 6.75 1 10 6.0 6 11 6.25 7 11 6.50 6 11 6.75 9 12 6.0 4 What how do I need to arrange my data to get it monotone increasing for griddata? Thanks for your help. One settled I will send you another example for the examples package. Kind regards, Timmie
This is a tricky one. It appears this bug also exists in 0.91.x, perhaps earlier as well, so it isn't a regression. I don't like the idea of setting the minimum to "1", especially for when the scale isn't log. Setting it to a really small positive value (like 1e-9) is better, but the autoscaling of the log plot then goes down to 1e-9 as well. Do any other developers have better suggestions? We may have to do some magic in at drawing time (or convince the autoscaler to ignore the stem lines) -- but I'd like to find a way that minimizes additional complexity. Cheers, Mike Dir...@in... wrote: > Hello, > > I tried to do a stem plot on an Axes with logarithmic scale, experiencing that the stemlines were not drawn... > > > ====axes.py (svn trunk, 2008年07月08日): > def stem(self, x, y, linefmt='b-', markerfmt='bo', basefmt='r-'): > [...] > stemlines = [] > for thisx, thisy in zip(x, y): > l, = self.plot([thisx,thisx], [0, thisy], linefmt) > stemlines.append(l) > > > After Axes.set_yscale('log'), Axes.stem() no longer draws the stemlines because it tries to draw from y=0, thereby apparently triggering some guard which prevents plotting log(0), hence suppressing the complete stemline. > > Dirty hacking, I replace [0, thisy] with [1, thisy] in case yscale=='log' and it works for my plots, but for sure there is more to do to make it robust... > > Please give me a heads-up if I just oversaw the Right Way to do a stem plot with logarithmic yscale. > > Cheers, > Dirk > > ------------------------------------------------------------------------- > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > Studies have shown that voting for your favorite open source project, > along with a healthy diet, reduces your potential for chronic lameness > and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > _______________________________________________ > 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
I'm surprised. That works for me. Can you (again) set verbose.level to "debug-annoying" and send the output? Cheers, Mike David M. Kaplan wrote: > Hi, > > Thanks for the suggestions. I have stopped using the usetex option. To > make math and normal text match, I tried the following: > > rcParams['font.family'] = 'serif' > rcParams['mathtext.fontset'] = 'stix' > > This didn't make them match - normal text looked to me like it was still > sans-serif, while mathtext was with serif. Is there something else I > should be doing to make this happen? > > Thanks again for your help. > > Cheers, > David > > > On Thu, 2008年07月10日 at 11:52 -0400, Darren Dale wrote: > >> Hi David, >> >> On Thursday 10 July 2008 11:15:37 am David M. Kaplan wrote: >> >>> 2) I have noticed that the font used for the xticklabels and the font >>> used for the xlabel and contour labels appears to be different (example >>> attached). One appears to be serif and the other sans-serif. This >>> seems to be due to using tex for text rendering. I am not sure if this >>> also occurred before the update, but I didn't notice it previously. >>> >> It has always been this way. We tried a workaround once a couple years back >> and it turned into a real mess. >> >> >>> Looking at the properties of the different text objects, it isn't >>> apparent that there should be a difference - both have font properties >>> that indicate sans-serif, but the text of tick labels appears to be >>> surrounded by $'s forcing it through the text parser, while that of the >>> contour labels is not. Is this difference normal or expected? Is there >>> a way around this? In particular, I would like to use sans-serif for >>> everything - is this possible while still using tex? >>> >> I think there is a package, sansmath or something like that, that will allow >> latex to use sans-serif fonts in math mode. You could try adding it to the >> text.latex.preamble rc setting, but that option is not officially supported. >> >> If you don't like the limitations of latex, you might want to turning off >> usetex and just use matplotlibs mathtext, which recently got a significant >> rewrite and is now quite capable thanks to Mike Droettboom. Here's some >> documentation too: >> http://matplotlib.sourceforge.net/doc/html/users/mathtext.html >> >> Darren >> -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA
Jeff Whitaker wrote: > Tim Michelsen wrote: > >> Dear Matplotlib-Users, >> I am tryring to create a contour plot over a basemap. >> >> My main problem is creating the array for the Z values as a basis for the >> plt.contour command from a CSV file where latitude, longitude and value are >> stored column-wise: >> >> lat; lon; value >> 50; 10; 6 >> ... >> >> The data represents a regular spaced grid with a datapoint each 0.25 degrees. >> >> I tried various possibilities but didn't have success: >> >> 1) following simpletest.py from the basemap examples: >> X, Y = meshgrid(data[:,1], data[:,0]) >> >> Z = data[:,2] >> >> > Timmie: Try: > > X, Y = meshgrid(data[:,1], data[:,0]) > Z = data[:,2] > nlons = X.shape[1]; nlats = X.shape[0] > Z = Z.reshape(nlats,nlons) > Timmie: Sorry, but upon further reflection I don't think this will work. You'll need to know the number of lats and the number of lons on the grid beforehand. Then you should be able to do X = X.reshape(nlats,nlons) Y = Y.reshape(nlats,nlons) Z = Z.reshape(nlats,nlons) after reading the data in. (skip the meshgrid call, that's only useful when X is a vector with length nlons and Y is a vector with length nlats). If you still have problems, send us a full example. -Jeff > >> m.contourf(x,y, Z) >> >> => Error: Z must be a 2D array >> -> How do I get Z to be a 2D array? >> >> 2) using the griddata package >> Here I was nearly without orientation how to call griddata correctly. >> >> > You don't need to use griddata since you have regularly gridded data. > >> 3) Using the python bindings of ogr >> Any examples on this one? >> >> > Again, no need. A simple reshape will get you the 2d lat/lon array you > need. > > >> >From my above demonstrated methods the following questions arrise: >> What is the preferred way to plot >> - Points stored in the above descripbed format (lat, lon, value)? >> - Interpolate a grid of data points by using different interpolation methods >> like inverse distance wheighting, natural neighbor interpolation, etc. to get a >> contour map? >> >> > > For interpolation of irregular, randomly distributed data points see > http://www.scipy.org/Cookbook/Matplotlib/Gridding_irregularly_spaced_data. > > However, if there is some structure to the data grid then it's probably > better not to use these approaches. > > -Jeff > > > > -- Jeffrey S. Whitaker Phone : (303)497-6313 NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449 325 Broadway Boulder, CO, USA 80305-3328
Tim Michelsen wrote: > Dear Matplotlib-Users, > I am tryring to create a contour plot over a basemap. > > My main problem is creating the array for the Z values as a basis for the > plt.contour command from a CSV file where latitude, longitude and value are > stored column-wise: > > lat; lon; value > 50; 10; 6 > ... > > The data represents a regular spaced grid with a datapoint each 0.25 degrees. > > I tried various possibilities but didn't have success: > > 1) following simpletest.py from the basemap examples: > X, Y = meshgrid(data[:,1], data[:,0]) > > Z = data[:,2] > Timmie: Try: X, Y = meshgrid(data[:,1], data[:,0]) Z = data[:,2] nlons = X.shape[1]; nlats = X.shape[0] Z = Z.reshape(nlats,nlons) > m.contourf(x,y, Z) > > => Error: Z must be a 2D array > -> How do I get Z to be a 2D array? > > 2) using the griddata package > Here I was nearly without orientation how to call griddata correctly. > You don't need to use griddata since you have regularly gridded data. > > 3) Using the python bindings of ogr > Any examples on this one? > Again, no need. A simple reshape will get you the 2d lat/lon array you need. > >From my above demonstrated methods the following questions arrise: > What is the preferred way to plot > - Points stored in the above descripbed format (lat, lon, value)? > - Interpolate a grid of data points by using different interpolation methods > like inverse distance wheighting, natural neighbor interpolation, etc. to get a > contour map? > For interpolation of irregular, randomly distributed data points see http://www.scipy.org/Cookbook/Matplotlib/Gridding_irregularly_spaced_data. However, if there is some structure to the data grid then it's probably better not to use these approaches. -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449 325 Broadway Boulder, CO, USA 80305-3328
Dear Matplotlib-Users, I am tryring to create a contour plot over a basemap. My main problem is creating the array for the Z values as a basis for the plt.contour command from a CSV file where latitude, longitude and value are stored column-wise: lat; lon; value 50; 10; 6 ... The data represents a regular spaced grid with a datapoint each 0.25 degrees. I tried various possibilities but didn't have success: 1) following simpletest.py from the basemap examples: X, Y = meshgrid(data[:,1], data[:,0]) Z = data[:,2] m.contourf(x,y, Z) => Error: Z must be a 2D array -> How do I get Z to be a 2D array? 2) using the griddata package Here I was nearly without orientation how to call griddata correctly. 3) Using the python bindings of ogr Any examples on this one? >From my above demonstrated methods the following questions arrise: What is the preferred way to plot - Points stored in the above descripbed format (lat, lon, value)? - Interpolate a grid of data points by using different interpolation methods like inverse distance wheighting, natural neighbor interpolation, etc. to get a contour map? Thanks in advance for your help & kind regards, Timmie
> Try > > import pylab > > instead of > > from pylab import * > > Manuel > I've already tried using import pylab and also just importing the functions that I'm using, but the result is always the same. AR
I've been trying to build and install matplotlib now for a few days, and have met with no success. I'm running OSX 10.5.4 on a MacBook Pro, Python 2.5.2 from MacPython, gcc 4.0.1, gfortran 4.3.0, and the latest version of Apple's XCode (3.1, which, if I understand correctly, has the necessary libpng and freetype libraries). I've got numpy 1.2.0 and scipy 0.6.0 installed so far. I'd read that I should set the following environment variables prior to building: export MACOSX_DEPLOYMENT_TARGET=10.5 export CFLAGS="-arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.5.sdk" export LDFLAGS="-arch i386 -arch ppc -isyslibroot,/Developer/SDKs/MacOSX10.5.sdk" Building starts off OK: ============================================================================ BUILDING MATPLOTLIB matplotlib: 0.98.1 python: 2.5.2 (r252:60911, Feb 22 2008, 07:57:53) [GCC 4.0.1 (Apple Computer, Inc. build 5363)] platform: darwin REQUIRED DEPENDENCIES numpy: 1.2.0.dev5312 freetype2: 9.16.3 OPTIONAL BACKEND DEPENDENCIES libpng: 1.2.8 Tkinter: Tkinter: 50704, Tk: 8.4, Tcl: 8.4 wxPython: 2.8.3.0 * WxAgg extension not required for wxPython >= 2.8 Gtk+: no * Building for Gtk+ requires pygtk; you must be able * to "import gtk" in your build/install environment Qt: no Qt4: no Cairo: no OPTIONAL DATE/TIMEZONE DEPENDENCIES datetime: present, version unknown dateutil: matplotlib will provide pytz: matplotlib will provide OPTIONAL USETEX DEPENDENCIES dvipng: 1.5 ghostscript: 8.61 latex: 3.141592 EXPERIMENTAL CONFIG PACKAGE DEPENDENCIES configobj: matplotlib will provide enthought.traits: 2.6b1-mpl [Edit setup.cfg to suppress the above messages] ============================================================================ ... but eventually chokes: g++ -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -g -bundle -undefined dynamic_lookup -arch i386 -arch ppc -isyslibroot,/Developer/SDKs/MacOSX10.5.sdk -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.5.sdk build/temp.macosx-10.5-fat-2.5/src/ft2font.o build/temp.macosx-10.5-fat-2.5/src/mplutils.o build/temp.macosx-10.5-fat-2.5/CXX/cxx_extensions.o build/temp.macosx-10.5-fat-2.5/CXX/cxxsupport.o build/temp.macosx-10.5-fat-2.5/CXX/IndirectPythonInterface.o build/temp.macosx-10.5-fat-2.5/CXX/cxxextensions.o -L/usr/X11/lib -L/sw/lib/freetype219/lib -L/usr/local/lib -L/usr/lib -L/sw/lib -L/usr/X11R6/lib -lfreetype -lz -lz -lstdc++ -lm -o build/lib.macosx-10.5-fat-2.5/matplotlib/ft2font.so -Wl,-framework,CoreServices,-framework,ApplicationServices ld warning: in /Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib/libgcc_s.10.5.dylib, missing required architecture i386 in file ld: in /Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib/libgcc_s.1.dylib, missing required architecture i386 in file for architecture i386 collect2: ld returned 1 exit status lipo: can't open input file: /var/folders/mX/mXK0L5vQF7elQu1RMPhkyU+++TI/-Tmp-//cc1JpFBv.out (No such file or directory) error: command 'g++' failed with exit status 1 It looks to me as if ld is trying to link to the wrong SDK (10.4 instead of 10.5) which might not be built for Intel Macs... is that right? Is that actually what's causing the build to fail? I'm totally stuck, and would appreciate any advice. -P -- Peter A. Selkin Assistant Professor, Environmental Geophysics IAS/Environmental Science University of Washington, Tacoma 1900 Commerce St., Box 358436 Tacoma, WA 98402 paselkin@u.washington.edu