Re: [Matplotlib-users] Contour Plotting of Varied Data on a Shape
Chris Barker wrote: I think it would be great to have in MPL. What code are you using for the triangulation? Does it do constrained delauney? My code only does the contouring; you have to input the triangulation. In the examples included with the code I used matplotlib.delaunay to do the triangulations so as not to reinvent the wheel. To include it in MPL, I would need to improve it somewhat (there are a couple of known bugs and insufficient documentation) and there would need to be a discussion of the API. At the moment I am using tricontour(x, y, triangulation_indices, z, optional_mask) followed by the usual contour args (N or V) and kwargs. Is this OK? I've also written utility plotting functions triplot, trifill and tripcolor; are these wanted? In terms of implementation, at the python level I have a TriContourSet class which is the same as the existing ContourSet apart from a few lines that deal with input arguments and calling the appropriate underlying C++ code. Ideally it would be sensible to refactor the common python code into a new class (BaseContourSet?) and have relatively thin derived ContourSet and TriContourSet classes. But I'm not sure you'd like a relatively new mpl contributor to change such important code... Ian -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] grey scale line plots
On Mar 9, 2010, at 9 Mar, 1:52 PM, Alan G Isaac wrote: I need a figure containing color line plots to be changed to grayscale, cycling through line styles instead of colors. How? On 3/9/2010 10:45 PM, Chloe Lewis wrote: Here's a skeleton, for a series of lines that get darker and more solid (from past to present, as I use it): Hi Chloe. I deduce from your approach that there is nothing built in. I am surprised: are most people able to publish color plots in their articles these days, so that the needed for a cycle of greyscale linestyles is too rare to make it into Matplotlib? Thanks! Alan -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Doc suggestion
Thanks. That's a good suggestion. It's been applied to SVN, and will make it on to the website the next time the website is updated. Mike David Arnold wrote: All, The linebuilder program on: http://matplotlib.sourceforge.net/users/event_handling.html Needs two extra lines, one at the beginning and one at the end. Their absence, particularly the second one, can cause confusion. import matplotlib.pyplot as plt class LineBuilder: def __init__(self, line): self.line = line self.xs = list(line.get_xdata()) self.ys = list(line.get_ydata()) self.cid = line.figure.canvas.mpl_connect('button_press_event', self) def __call__(self, event): print 'click', event if event.inaxes!=self.line.axes: return self.xs.append(event.xdata) self.ys.append(event.ydata) self.line.set_data(self.xs, self.ys) self.line.figure.canvas.draw() fig = plt.figure() ax = fig.add_subplot(111) ax.set_title('click to build line segments') line, = ax.plot([0], [0]) # empty line linebuilder = LineBuilder(line) plt.show() -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net 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 -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] shiftgrid 'cyclic point not included' error
Anton Vasilescu wrote: Hi Jeff, Thank you for looking at the code for me! It works perfect for the first image but when it tries to do the second it errors out saying: lon0 outside of range of lonsin. Any idea why is that happening? Is it happening for you too? Thanks, Anton Anton: Probably because the original value of lons has been overwritten with the shifted grid longitudes. You need to save the original lons array to pass to shiftgrid for the second grid. -Jeff *From:* Jeff Whitaker jsw...@fastmail.fm *To:* antonv vasilescu_an...@yahoo.com *Cc:* matplotlib-users@lists.sourceforge.net *Sent:* Mon, March 8, 2010 12:50:48 PM *Subject:* Re: [Matplotlib-users] shiftgrid 'cyclic point not included' error antonv wrote: Hi Jeff, Here is the whole script: http://old.nabble.com/file/p27826457/_test_shiftgrid.py _test_shiftgrid.py http://_test_shiftgrid.py And here are the grib data files: http://socalscubainfo.com/downloads/GRIB2_files.zip Also, if there is not too much to ask, is there a sample anywhere that shows how to use shiftgrid for a mercator projection? If you look at the script, I was initially trying to make the images using the mercator projection (there is a commented basemap function there) but it would display just the data starting from the origin. I was wondering how would I be able to display let's say the whole globe but shift the grid 180 so that great britain would be in the center of the map rather than being cut at the edge. Thanks, Anton Anton: You weren't updating the lons and lats to be consistent with the shifted grid. I changed the lines #z, lons[i] = shiftgrid(180.0, z, lons[i], start=False, cyclic=360.0) #zq, lons_a[i] = shiftgrid(180.0, zq, lons_a[i], start=False, cyclic=360.0) in your script to lons1 = lons[0,:] z, lonsnew = shiftgrid(180.0, z, lons1, start=False) zq, lonsnew = shiftgrid(180.0, zq, lons1, start=False) lons, lonsnew = shiftgrid(180.0, lons, lons1, start=False) lats, lonsnew = shiftgrid(180.0, lats, lons1, start=False) and it works fine. -Jeff Jeff Whitaker wrote: antonv wrote: Hi Jeff, Thanks for the quick reply! I've updated to the latest shiftgrid and now I get the chart :D I still have a small issue as there is a half degree sliver missing from the mapping at the greenwich meridian. Any idea how to solve that issue? Here is an image showing that (above england): http://old.nabble.com/file/p27824785/Global-HTSGW_DIRPW-0.png Thanks, Anton Anton: Looks like the values at the Greenwich meridian got messed up somehow. Can you post your script somewhere so I can try it out? -Jeff Jeff Whitaker wrote: antonv wrote: Hi all, I am getting a 'cyclic point not included' error using shiftgrid on a grib file from NOAA. I've checked and it seems that the file has the lons from 0 to 359.5 every .5 degree but I get that error whenever I try to run this. What I need to achieve is to shift the grid from 0 / 360 to -180 / 180 so that I can create a map over Great Britain. I am using a Cassini projection. Anton: You can add the wraparound, or cyclic point using the addcyclic function. Or, you can update to the latest svn version of basemap which does not have this restriction. -Jeff -- Jeffrey S. WhitakerPhone : (303)497-6313 Meteorologist FAX: (303)497-6449 NOAA/OAR/PSD R/PSD1Email : jeffrey.s.whita...@noaa.gov mailto:jeffrey.s.whita...@noaa.gov 325 BroadwayOffice : Skaggs Research Cntr 1D-113 Boulder, CO, USA 80303-3328 Web: http://tinyurl.com/5telg -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net mailto:Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Jeffrey S. WhitakerPhone : (303)497-6313 Meteorologist FAX: (303)497-6449 NOAA/OAR/PSD R/PSD1Email : jeffrey.s.whita...@noaa.gov mailto:jeffrey.s.whita...@noaa.gov 325 BroadwayOffice : Skaggs Research Cntr 1D-113 Boulder, CO, USA 80303-3328 Web: http://tinyurl.com/5telg -- Download Intel® Parallel Studio Eval Try the new software
Re: [Matplotlib-users] shiftgrid 'cyclic point not included' error
You're right, the lons was getting overwritten! Thanks again for the help! Anton From: Jeff Whitaker jsw...@fastmail.fm To: Anton Vasilescu vasilescu_an...@yahoo.com Cc: matplotlib-users@lists.sourceforge.net Sent: Wed, March 10, 2010 8:57:16 AM Subject: Re: [Matplotlib-users] shiftgrid 'cyclic point not included' error Anton Vasilescu wrote: Hi Jeff, Thank you for looking at the code for me! It works perfect for the first image but when it tries to do the second it errors out saying: lon0 outside of range of lonsin. Any idea why is that happening? Is it happening for you too? Thanks, Anton Anton: Probably because the original value of lons has been overwritten with the shifted grid longitudes. You need to save the original lons array to pass to shiftgrid for the second grid. -Jeff *From:* Jeff Whitaker jsw...@fastmail.fm *To:* antonv vasilescu_an...@yahoo.com *Cc:* matplotlib-users@lists.sourceforge.net *Sent:* Mon, March 8, 2010 12:50:48 PM *Subject:* Re: [Matplotlib-users] shiftgrid 'cyclic point not included' error antonv wrote: Hi Jeff, Here is the whole script: http://old.nabble.com/file/p27826457/_test_shiftgrid.py _test_shiftgrid.pyhttp://_test_shiftgrid.py And here are the grib data files: http://socalscubainfo.com/downloads/GRIB2_files.zip Also, if there is not too much to ask, is there a sample anywhere that shows how to use shiftgrid for a mercator projection? If you look at the script, I was initially trying to make the images using the mercator projection (there is a commented basemap function there) but it would display just the data starting from the origin. I was wondering how would I be able to display let's say the whole globe but shift the grid 180 so that great britain would be in the center of the map rather than being cut at the edge. Thanks, Anton Anton: You weren't updating the lons and lats to be consistent with the shifted grid. I changed the lines #z, lons[i] = shiftgrid(180.0, z, lons[i], start=False, cyclic=360.0) #zq, lons_a[i] = shiftgrid(180.0, zq, lons_a[i], start=False, cyclic=360.0) in your script to lons1 = lons[0,:] z, lonsnew = shiftgrid(180.0, z, lons1, start=False) zq, lonsnew = shiftgrid(180.0, zq, lons1, start=False) lons, lonsnew = shiftgrid(180.0, lons, lons1, start=False) lats, lonsnew = shiftgrid(180.0, lats, lons1, start=False) and it works fine. -Jeff Jeff Whitaker wrote: antonv wrote: Hi Jeff, Thanks for the quick reply! I've updated to the latest shiftgrid and now I get the chart :D I still have a small issue as there is a half degree sliver missing from the mapping at the greenwich meridian. Any idea how to solve that issue? Here is an image showing that (above england): http://old.nabble.com/file/p27824785/Global-HTSGW_DIRPW-0.png Thanks, Anton Anton: Looks like the values at the Greenwich meridian got messed up somehow. Can you post your script somewhere so I can try it out? -Jeff Jeff Whitaker wrote: antonv wrote: Hi all, I am getting a 'cyclic point not included' error using shiftgrid on a grib file from NOAA. I've checked and it seems that the file has the lons from 0 to 359.5 every .5 degree but I get that error whenever I try to run this. What I need to achieve is to shift the grid from 0 / 360 to -180 / 180 so that I can create a map over Great Britain. I am using a Cassini projection. Anton: You can add the wraparound, or cyclic point using the addcyclic function. Or, you can update to the latest svn version of basemap which does not have this restriction. -Jeff -- Jeffrey S. WhitakerPhone : (303)497-6313 Meteorologist FAX: (303)497-6449 NOAA/OAR/PSD R/PSD1Email : jeffrey.s.whita...@noaa.gov mailto:jeffrey.s.whita...@noaa.gov 325 BroadwayOffice : Skaggs Research Cntr 1D-113 Boulder, CO, USA 80303-3328 Web: http://tinyurl.com/5telg -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net mailto:Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Jeffrey S. WhitakerPhone : (303)497-6313 Meteorologist FAX: (303)497-6449 NOAA/OAR/PSD R/PSD1Email :
[Matplotlib-users] GTK+ config on Fedora 12.... change in filesystem structure?
Hi there, I am not sure whether I am the only one to experience that but on my new FEDORA 12 box GTK+ is shipped with the following structure for the headers : /usr/include/gtk-1.2/gtk/gtk.h This does not seem to be expected by matplotlib setup.cfg , or am I missing something? thanks, Johann -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] plot a lambda function?
Hi. Is it possible to plot arbitrary lambda function with matplotlib? Say, if i have f = lambda x: x*sin(x), can i just plot it without building argument-value arrays? It would be a very convenient and useful feature. -- Sincerely, max ulidtko -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Making tick marks of a secondary axis line up with the primary axis
Hi there, I'm trying to make a plot with two y axes. I'm able to do that no problem, but what I'd really like to do now is make the tick marks line up for them both so that they both use the same grid. Is there a simple way to do this? Basically, I want to force the number of tick marks on the right hand axis to be the same as on the left hand axis, and I'd like it to select nice numbers to do so (ie not intervals of .358 or something). Also, on a somewhat related note, is there a simple way to force the y ticks to start at 0 rather than some other value? Thanks a lot, Alex -- View this message in context: http://old.nabble.com/Making-tick-marks-of-a-secondary-axis-line-up-with-the-primary-axis-tp27854166p27854166.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] plot a lambda function?
You'd always have to specify the domain, so plot(map(lambda x:x**2, range(1,10))) shouldn't be much longer than the minimal command. C On Mar 10, 2010, at 10:12 AM, max ulidtko wrote: Hi. Is it possible to plot arbitrary lambda function with matplotlib? Say, if i have f = lambda x: x*sin(x), can i just plot it without building argument-value arrays? It would be a very convenient and useful feature. -- Sincerely, max ulidtko -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] plot a lambda function?
How about this (though it is getting a little clunky): plot(*transpose(map(lambda x:(x,sin(x**2)/x**3), arange(3,6, 0.01 On Wed, Mar 10, 2010 at 7:57 PM, Chloe Lewis chle...@berkeley.edu wrote: ...although plot(map(lambda x:x**2, range(5,15))) probably doesn't do exactly what you want; is the idea that plot(range(5,15),lambda x:x**2) #DOESN'T WORK should automatically work like plot(range(5,15), map(lambda x:x**2, range(5,15))) by recognizing that the second argument is a function rather than a list? C On Mar 10, 2010, at 10:47 AM, Chloe Lewis wrote: You'd always have to specify the domain, so plot(map(lambda x:x**2, range(1,10))) shouldn't be much longer than the minimal command. C On Mar 10, 2010, at 10:12 AM, max ulidtko wrote: Hi. Is it possible to plot arbitrary lambda function with matplotlib? Say, if i have f = lambda x: x*sin(x), can i just plot it without building argument-value arrays? It would be a very convenient and useful feature. -- Sincerely, max ulidtko -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Making tick marks of a secondary axis line up with the primary axis
-Original Message- From: Alex S [mailto:schmitt.happ...@gmail.com] Hi there, I'm trying to make a plot with two y axes. I'm able to do that no problem, but what I'd really like to do now is make the tick marks line up for them both so that they both use the same grid. Is there a simple way to do this? Basically, I want to force the number of tick marks on the right hand axis to be the same as on the left hand axis, and I'd like it to select nice numbers to do so (ie not intervals of .358 or something). Hey Alex, I always just figure this out on my own. There might exist a more elegant way though. Starting with this: import matplotlib.pyplot as plt fig = plt.figure() ax1 = fig.add_subplot(111) ax2 = ax1.twinx() # plot stuff # So then you could do something like: ytx1 = ax1.get_yticks() ...and then use to len(ytx1) and range() to ax2.set_yticks(blahblah). The tricky part is picking a max for your range() so that your stepsize produces nice numbers. Also, on a somewhat related note, is there a simple way to force the y ticks to start at 0 rather than some other value? ax1.set_ylim(ymin=0) HTH, -paul h. -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] turn off tick reflection
Dear matplotlib users, I'm trying to make a plot that shares the x axis, but that have two different y scales. I can do this, almost, I say almost because I don't know how to turn off the reflection of my y ticks, so they are reflected and obscure the scale on the other side, if the scales aren't similar. I looked at the example http://matplotlib.sourceforge.net/plot_directive/mpl_examples/api/two_scales.py and it hints at a solution (Hint: use the xaxis instance and call tick_bottom and tick_top in place of tick_left and tick_right.), but this doesn't make any sense to me. I think I need to Turn the axes rectangular frame off on the 2nd axes to keep it from obscuring the first. but I'm not sure if this is what I need to do, if it is, I'm also not sure how to do this. Thanks for any ideas, Matthew -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users