Re: [Matplotlib-users] Polar plot
Hi Tony, Thank you for the reply, the solutions you propose are fine in this case. But I'm trying to use the polar plot as a smith chart for an instrument and there i will receive data that is unknown but can be something like this: r = np.transpose(.1+np.arange ( 0 , 0.7 , 0.001)) theta = -4.5 * np.pi *r freq = r*10e9 data = np.multiply(r,np.exp(1j*theta)) ax.plot(angle(data),abs(data)) Any idea why Polar plot can't handle theta going from negative to positive radians? Jan Tony S Yu wrote: > > On Sep 17, 2008, at 1:59 AM, jan gillis wrote: > >> Hello, >> >> I have a problem with polar plot, if i run the following code in >> matplotlib 0.98.3, polar plot is drawing a extra circle to go from >> angle -3.14159265 to angle 3.03753126. Is there a solution for this >> problem? >> >> >> import numpy as np >> from matplotlib.pyplot import figure, show, rc, grid >> >> # radar green, solid grid lines >> rc('grid', color='#316931', linewidth=1, linestyle='-') >> rc('xtick', labelsize=15) >> rc('ytick', labelsize=15) >> >> # force square figure and square axes looks better for polar, IMO >> fig = figure(figsize=(8,8)) >> ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True, axisbg='#d5de9c') >> >> z = np.zeros((1,2000),complex) >> z.real = 0.2 >> z.imag = np.arange(-50,50,0.05) >> gamma_r = np.transpose((z-1)/(z+1)) >> >> ax.plot(np.angle(gamma_r), np.abs(gamma_r), '.-', zorder=0) > > Hi Jan, > > It looks like you get the circle because the angles you're plotting go > from negative to positive radians in a weird way. The circle being > drawn starts around 0 radians and goes clockwise by negative values. > Then when it gets to - pi, it switches to positive indices, i.e. pi. > Of course, these are the same points on a polar plot, but different > angles, if you want to be consistent. > > Here are a couple of quick solutions, but there but there maybe better > ways of handling this. > > # ~~ > # get rid of the plot line above, and add the following > theta = np.angle(gamma_r) > mag = np.abs(gamma_r) > > # option 1 > ordered = np.argsort(theta, axis=0).squeeze() > ax.plot(theta[ordered], mag[ordered], '.-', zorder=0) > > # option 2 > neg_theta = np.where(theta < 0) > theta[neg_theta] += 2 * np.pi > ax.plot(theta, mag, '.-', zorder=0) > # ~~ > > I hope that's helpful, > -Tony > >> >> ax.set_rmax(2.0) >> grid(True) >> >> show() >> >> >> Kind regards, >> Jean >> >> >> - >> >> This SF.Net email is sponsored by the Moblin Your Move Developer's >> challenge >> Build the coolest Linux based applications with Moblin SDK & win >> great prizes >> Grand prize is a trip for two to an Open Source event anywhere in the >> world >> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >> ___ >> Matplotlib-users mailing list >> Matplotlib-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] quiver aspect ratio
Recently I noticed that the quiver plots all make the arrows as if the plot had aspect ratio 1. See, for example, the documentation for quiver: In all cases the arrow aspect ratio is 1, so that if *U*==*V* the angle of the arrow on the plot is 45 degrees CCW from the *x*-axis. This seems to make the plot pretty useless if the aspect ratio is not 1, since then the slopes of the arrows do not match up with the coordinate axes. What is the reason for this design decision? Does it have to do with the arrows distorting if the aspect ratio is not 1? At one time, there was talk of adding a line version of quiver (as opposed to the patch version there now). See http://article.gmane.org/gmane.comp.python.matplotlib.devel/1885. Has that happened? I suppose a line version would allow different aspect ratios. Is there an easy way to get a correct quiver plot (i.e., correct slopes) now if the aspect ratio is not 1? Thanks, Jason - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Square Axes
Adjusting a physical size of the axes is a bit tricky in matplotlib, as the axes has an fixed position in normalized figure coordinate. But, I guess setting the axes aspect ratio in physical size is doable relatively easily, at least if your x,y axis are in linear scales. For example, if you want a square axes, set the aspect as the inverse of your data aspect (ratio). ax.set_aspect(1./ax.get_data_ratio()) As you see, you need to reset the aspect whenever your data limit changes. IHTH, -JJ On Wed, Sep 17, 2008 at 2:41 PM, Erik Tollerud <[EMAIL PROTECTED]> wrote: > I would like to ensure that the axes on a plot I'm making are square > in the sense of how the axes appear in the figure. I tried using > ax.set_aspect(1) , but that squares the axes in data coordinates, > rather than in figure coordinates. So aside from generating a figure > that is always square (which doesn't always work anyway if, for > example, I want a colorbar), how can I force the axes to be a > particular axis ratio in coordinates of physical size on the page? > > - > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] adding a filled rectangle
import matplotlib.pyplot as plt import matplotlib.patches as mpatches xy = 0.3, 0.3, width, height = 0.2, 0.5 p = mpatches.Rectangle(xy, width, height, facecolor="orange", edgecolor="red") plt.gca().add_patch(p) plt.draw() A Rectangle is a patch class and (although I'm not sure) I don't think there is a helper function to easily create a patch object in the pyplot level. To draw a Rectangle (or any patch object), you need to import matplotlib.patches module, create a patch object and add it to your axes (add_patch method). The doc says that hatch is only supported in ps backend. Check the set_hatch method. Regards, -JJ On Wed, Sep 17, 2008 at 1:06 PM, Ryan Pavlovicz <[EMAIL PROTECTED]> wrote: > Hi. I'd like to add a filled area on my graph to denote the standard > deviation from an average. Additionally, i'd prefer the fill to be a > diagonal hatch. Reading online, i found that there is a 'Rectangle' class, > but i can't get this to work. Can someone suggest a good way to get the > results i'm looking for? Thanks! > > - > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great > prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Lines drawn across NaN data
I'm having trouble plotting data with NaN values. My plot has lines and markers and usually both are skipped for NaN values. But when I have more than 127 data a line is drawn from the last non-NaN to the next. I read somewhere about a similar issue (maybe here? sorry I can't find it just now), it seems like it has to do with some optimization performed for large datasets and the use if lineto instead of moveto or something like that. It was supposed to be fixed in 0.98.2 but I'm using 0.98.3 from Benjamin Drung's PPA (http://ppa.launchpad.net/bdrung). This code shows the difference between plotting 127 and 128 data (look at the left of each figure): import pylab as pl x = pl.random(128) x[4:7] = pl.NaN y = x[:-1] pl.figure(1) pl.plot(x, '-o') pl.grid(True) pl.figure(2) pl.plot(y, '-o') pl.grid(True) pl.show() Is this a known issue? Is there any workaround? Thanks Goyo - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] save or pickle figure object
On Wed, Sep 17, 2008 at 12:55:40PM -0700, Ted Drain wrote: > I agree completely - I was just pointing that it is possible. I think what > people might not be aware of is that it's really an all or nothing > proposition. You either jump in completely and pay the large cost to handle > this in a maintainable, scalable way or don't do it at all. All of the > "quick and easy" solutions have too many problems and aren't really > maintainable. Here is my (easy and maintainable) way to handle the versions for my graphics: * I write the data creation in a python script * I write the creation of the mpl graphics in a script (most the same) * I manage these python file with a version-system (eg mercurial) So I have different versions for my mpl graphics and I can modify the graphic any time (with a new python run). If the data creation takes too long, I could save the data in an extra file (eg pickle file) and versioning the pickled file. So I dont need an extra way to reedit a mpl graphic. By, Friedrich - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] save or pickle figure object
Josef, I too have been interested in such a feature for matplotlib and have made some (albeit lame) stabs at finding a solution. I started a project on google code that has some very limited capacity to save line plots and the necessary data arrays from matplotlib into an hdf5 file for later processing. It is by no means a complete solution but may serve as a VERY rough model to add this functionality. It was my hope that if you could capture the underlying keyword arguments necessary to recreate a plot then you might be able to simply recreate the original figure assuming the correct interpreter functions are established. Anyway, if you are interested please take a look to see if there may be something useful. From the perspective of the IPython users out there, a question to you: is there a good way to do achieve this feature with some of the logging commands? http://code.google.com/p/subplot/ Cheers, Brian -ps excuse the name of the project--I lacked creative drive at the time of naming. --- On Tue, 9/16/08, John Hunter <[EMAIL PROTECTED]> wrote: From: John Hunter <[EMAIL PROTECTED]> Subject: Re: [Matplotlib-users] save or pickle figure object To: "Josef Koller" <[EMAIL PROTECTED]> Cc: matplotlib-users@lists.sourceforge.net Date: Tuesday, September 16, 2008, 7:49 PM On Tue, Sep 16, 2008 at 5:06 PM, Josef Koller <[EMAIL PROTECTED]> wrote: > Hi folks, > I would like to save preliminary figures for later processing and > refinement with matplotlib. Is there a way to save or pickle a figure > object and later reload it. Matlab has a feature like that and and I was > wondering if matplotlib has it too. No, it doesn't exist. We've taken a stab at it once or twice, but have been stymied because we make extensive use of a python extension libray CXX, and these objects have resisted our attempts to pickle them. With our recent transforms refactoring, which removes the hairiest CXX dependency, it may be worth taking another look, but noone is currently working on it. JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] save or pickle figure object
I agree completely - I was just pointing that it is possible. I think what people might not be aware of is that it's really an all or nothing proposition. You either jump in completely and pay the large cost to handle this in a maintainable, scalable way or don't do it at all. All of the "quick and easy" solutions have too many problems and aren't really maintainable. Ted > -Original Message- > From: Eric Firing [mailto:[EMAIL PROTECTED] > Sent: Wednesday, September 17, 2008 12:01 PM > To: Ted Drain > Cc: matplotlib-users@lists.sourceforge.net > Subject: Re: [Matplotlib-users] save or pickle figure object > > Ted Drain wrote: > > We have some experience maintaining persistent object storage over > long > > periods of time. The best solution we've found is to do something > like > > this: > > > > - create a read/write method on each class. Every class that needs > to be > > stored must have this. This includes class you would store (eg > Figure) and > > things that are member variables of those classes. > > > > - Each class stores a version number along with it's data which > represents > > the version of the persistent representation for that class. So each > class > > has its own, internal versioning scheme that represents a specific > set of > > variables with specific types. > > > > - The read method on each class must check the version number and > then read > > the appropriate data for that version of itself. Whenever the > persistent > > representation of the class changes (usually if the member variables > > change), you increment the version number. Implicit in this is that > if you > > change the member variables of a class, the class read method must be > able > > to convert the variables that existed in the older version of itself > into > > the new member variables (since that's what the new methods on that > class > > will be using) > > > > FYI It is possible to use pickle to do this but you can't rely on > pickle to > > automatically save the member dictionary. You need to implement > > __getstate__ and __setstate__ and have them incorporate a version > number in > > the dictionary they return. In addition, you shouldn't blindly save > every > > member variable. If member variables can be constructed in terms of > other > > data, it may be better to store that data and then reconstruct the > member > > variables in the __setstate__ method. > > > > Using this type of system, you get a hierarchy of objects that each > have > > their own, internal versioning system. This lets you make changes to > a > > single class, increment it's version, and update its save/load > methods and > > it won't affect any other part of the system and still retains > backwards > > reading capability. > > > > Ted > > Sounds good--for some applications--but I would strongly oppose adding > this additional level of complexity to mpl. It's just not worth it. > If > you want to be able to work with a plot, then generate it with a > script, > and save the data and the script. That is the user's responsibility, > not mpl's. > > Unless mpl is taken over by a cadre of full-time professional > programmers, we have to try to keep it accessible to people who can > only > work on it sporadically. That means we need to try to keep it > simple--indeed, to work on simplifying it and cleaning up the rough > edges, and to work on maintaining a design that makes it easy to > improve > the real plotting capabilities and ease-of-use. > > Eric > > > > > >> -Original Message- > >> From: [EMAIL PROTECTED] > >> [mailto:[EMAIL PROTECTED] On Behalf Of > >> Eric Firing > >> Sent: Tuesday, September 16, 2008 7:04 PM > >> To: John Hunter > >> Cc: Josef Koller; matplotlib-users@lists.sourceforge.net > >> Subject: Re: [Matplotlib-users] save or pickle figure object > >> > >> John Hunter wrote: > >>> On Tue, Sep 16, 2008 at 5:06 PM, Josef Koller <[EMAIL PROTECTED]> > >> wrote: > Hi folks, > I would like to save preliminary figures for later processing and > refinement with matplotlib. Is there a way to save or pickle a > >> figure > object and later reload it. Matlab has a feature like that and and > I > >> was > wondering if matplotlib has it too. > >>> No, it doesn't exist. We've taken a stab at it once or twice, but > >>> have been stymied because we make extensive use of a python > extension > >>> libray CXX, and these objects have resisted our attempts to pickle > >>> them. With our recent transforms refactoring, which removes the > >>> hairiest CXX dependency, it may be worth taking another look, but > >>> noone is currently working on it. > >> My sense, based on very little experience, is that pickles of > >> complicated objects are very fragile, so even if we could pickle > >> figures, I fear it might cause more trouble ("I can't load this > >> absolutely critical figure I pickled 6 months ago") than it would be > >> worth. > >> > >> Eric > >> > >> -
Re: [Matplotlib-users] save or pickle figure object
Ted Drain wrote: > We have some experience maintaining persistent object storage over long > periods of time. The best solution we've found is to do something like > this: > > - create a read/write method on each class. Every class that needs to be > stored must have this. This includes class you would store (eg Figure) and > things that are member variables of those classes. > > - Each class stores a version number along with it's data which represents > the version of the persistent representation for that class. So each class > has its own, internal versioning scheme that represents a specific set of > variables with specific types. > > - The read method on each class must check the version number and then read > the appropriate data for that version of itself. Whenever the persistent > representation of the class changes (usually if the member variables > change), you increment the version number. Implicit in this is that if you > change the member variables of a class, the class read method must be able > to convert the variables that existed in the older version of itself into > the new member variables (since that's what the new methods on that class > will be using) > > FYI It is possible to use pickle to do this but you can't rely on pickle to > automatically save the member dictionary. You need to implement > __getstate__ and __setstate__ and have them incorporate a version number in > the dictionary they return. In addition, you shouldn't blindly save every > member variable. If member variables can be constructed in terms of other > data, it may be better to store that data and then reconstruct the member > variables in the __setstate__ method. > > Using this type of system, you get a hierarchy of objects that each have > their own, internal versioning system. This lets you make changes to a > single class, increment it's version, and update its save/load methods and > it won't affect any other part of the system and still retains backwards > reading capability. > > Ted Sounds good--for some applications--but I would strongly oppose adding this additional level of complexity to mpl. It's just not worth it. If you want to be able to work with a plot, then generate it with a script, and save the data and the script. That is the user's responsibility, not mpl's. Unless mpl is taken over by a cadre of full-time professional programmers, we have to try to keep it accessible to people who can only work on it sporadically. That means we need to try to keep it simple--indeed, to work on simplifying it and cleaning up the rough edges, and to work on maintaining a design that makes it easy to improve the real plotting capabilities and ease-of-use. Eric > >> -Original Message- >> From: [EMAIL PROTECTED] >> [mailto:[EMAIL PROTECTED] On Behalf Of >> Eric Firing >> Sent: Tuesday, September 16, 2008 7:04 PM >> To: John Hunter >> Cc: Josef Koller; matplotlib-users@lists.sourceforge.net >> Subject: Re: [Matplotlib-users] save or pickle figure object >> >> John Hunter wrote: >>> On Tue, Sep 16, 2008 at 5:06 PM, Josef Koller <[EMAIL PROTECTED]> >> wrote: Hi folks, I would like to save preliminary figures for later processing and refinement with matplotlib. Is there a way to save or pickle a >> figure object and later reload it. Matlab has a feature like that and and I >> was wondering if matplotlib has it too. >>> No, it doesn't exist. We've taken a stab at it once or twice, but >>> have been stymied because we make extensive use of a python extension >>> libray CXX, and these objects have resisted our attempts to pickle >>> them. With our recent transforms refactoring, which removes the >>> hairiest CXX dependency, it may be worth taking another look, but >>> noone is currently working on it. >> My sense, based on very little experience, is that pickles of >> complicated objects are very fragile, so even if we could pickle >> figures, I fear it might cause more trouble ("I can't load this >> absolutely critical figure I pickled 6 months ago") than it would be >> worth. >> >> Eric >> >> --- >> -- >> This SF.Net email is sponsored by the Moblin Your Move Developer's >> challenge >> Build the coolest Linux based applications with Moblin SDK & win great >> prizes >> Grand prize is a trip for two to an Open Source event anywhere in the >> world >> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >> ___ >> Matplotlib-users mailing list >> Matplotlib-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> Checked by AVG - http://www.avg.com >> Version: 8.0.169 / Virus Database: 270.6.21/1674 - Release Date: >> 9/16/2008 8:15 AM > > > - > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Bu
[Matplotlib-users] Square Axes
I would like to ensure that the axes on a plot I'm making are square in the sense of how the axes appear in the figure. I tried using ax.set_aspect(1) , but that squares the axes in data coordinates, rather than in figure coordinates. So aside from generating a figure that is always square (which doesn't always work anyway if, for example, I want a colorbar), how can I force the axes to be a particular axis ratio in coordinates of physical size on the page? - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] adding a filled rectangle
Hi. I'd like to add a filled area on my graph to denote the standard deviation from an average. Additionally, i'd prefer the fill to be a diagonal hatch. Reading online, i found that there is a 'Rectangle' class, but i can't get this to work. Can someone suggest a good way to get the results i'm looking for? Thanks! - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Information request
John Hunter wrote: > On Wed, Sep 17, 2008 at 11:54 AM, John Hunter <[EMAIL PROTECTED]> wrote: > > >> Attached is a screenshot (zoom.png) from the gimp, zoomed in near the >> axes border. The black horizontal line is the top axes border, the >> horizontal grey line is the artifact, the vertical dashed line is a >> grid line. I don't know if this offers a clue, but if you look at a >> zoom in the upper right corner, the grey line seems to break up and >> curve down and to the right (corner.png) >> > > Sorry, screwed up corner.png (I attached the original and not the > screenshot). The correct screenshot is attached > > > John: OK, now I finally see it. Antoine: Do these artifacts disappear if you comment out the imshow call? -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX: (303)497-6449 NOAA/OAR/PSD R/PSD1Email : [EMAIL PROTECTED] 325 BroadwayOffice : Skaggs Research Cntr 1D-113 Boulder, CO, USA 80303-3328 Web: http://tinyurl.com/5telg - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Information request
On Wed, Sep 17, 2008 at 11:54 AM, John Hunter <[EMAIL PROTECTED]> wrote: > Attached is a screenshot (zoom.png) from the gimp, zoomed in near the > axes border. The black horizontal line is the top axes border, the > horizontal grey line is the artifact, the vertical dashed line is a > grid line. I don't know if this offers a clue, but if you look at a > zoom in the upper right corner, the grey line seems to break up and > curve down and to the right (corner.png) Sorry, screwed up corner.png (I attached the original and not the screenshot). The correct screenshot is attached <>- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Information request
John Hunter wrote: > On Wed, Sep 17, 2008 at 11:08 AM, Jeff Whitaker <[EMAIL PROTECTED]> wrote: > >> De Pauw Antoine wrote: >> >>> Jeff, >>> >>> I finally managed to obtain a neat image with imshow and griddata >>> >>> The code snippet is here: >>> http://snipplr.com/view/8307/map-plotting-python-code-temporary/ >>> >>> The only problem I have is now a grey line surrounding the plot, as you can >>> see in this low-res sample: >>> http://www.kirikoo.net/images/5shrad-20080917-151205.png >>> >>> >> Antoine: Sorry, but I don't see it. >> > > There is a very faint horizontal grey line at the top and bottom of > the plot, just inside the axes border. I think this is what he is > referring to. > > JDH > John: Well, you're eyes are better than mine. I still can't see it. No idea why it might be there either. -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX: (303)497-6449 NOAA/OAR/PSD R/PSD1Email : [EMAIL PROTECTED] 325 BroadwayOffice : Skaggs Research Cntr 1D-113 Boulder, CO, USA 80303-3328 Web: http://tinyurl.com/5telg - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Information request
On Wed, Sep 17, 2008 at 11:08 AM, Jeff Whitaker <[EMAIL PROTECTED]> wrote: > De Pauw Antoine wrote: >> Jeff, >> >> I finally managed to obtain a neat image with imshow and griddata >> >> The code snippet is here: >> http://snipplr.com/view/8307/map-plotting-python-code-temporary/ >> >> The only problem I have is now a grey line surrounding the plot, as you can >> see in this low-res sample: >> http://www.kirikoo.net/images/5shrad-20080917-151205.png >> > > Antoine: Sorry, but I don't see it. There is a very faint horizontal grey line at the top and bottom of the plot, just inside the axes border. I think this is what he is referring to. JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] yaxis labels using subplot
I believe that "set" function in matplotlib has been deprecated (because "set" is now python builtin). Instead, you have to use "setp". Setting "xticks" (or "yticks") changes the tick locations. If you're trying to turn off only the labels, you may use use setp(gca().get_yticklabels(), visible=False) IHTH, -JJ 2008/9/17 Nicholas Stephens <[EMAIL PROTECTED]>: > Hi all, > > Actually this is more like two problems :-) > > I am trying to turn off the yaxis labels on the right hand side figure > generated via subplot. After some trial and error it seems that I should be > able to change these settings using the set command. For example you should > be bale to do the following > > plot([1,2,3,4], [1,4,9,16]) > set(gca(), 'xticks', [1,2,3,4]) > > as per the ipython instructions. However I have a complaint about the number > of arguements (see below). This has been tried in a variety of ways, apart > from a way that actually works. > > In [1]: plot([1,2,3,4], [1,4,9,16]) > Out[1]: [] > > In [2]: set(gca(), 'xticks', [1,2,3,4]) > --- > Traceback (most recent call last) > > /home/stephens/Fe_profiles/20yr_SS_BATS/ in () > > : set expected at most 1 arguments, got 3 > > > So i)does anybody know of an easy (/sucessful) way of turning off the rhs > yaxis labels and ii) does anybody know why I am apparently having issues > with putting more than one argument in the set command when, according to > the help instructions, it should be possible. > > thanks in advance, > > nick stephens > > > - > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great > prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Polar plot
On Sep 17, 2008, at 1:59 AM, jan gillis wrote: > Hello, > > I have a problem with polar plot, if i run the following code in > matplotlib 0.98.3, polar plot is drawing a extra circle to go from > angle -3.14159265 to angle 3.03753126. Is there a solution for this > problem? > > > import numpy as np > from matplotlib.pyplot import figure, show, rc, grid > > # radar green, solid grid lines > rc('grid', color='#316931', linewidth=1, linestyle='-') > rc('xtick', labelsize=15) > rc('ytick', labelsize=15) > > # force square figure and square axes looks better for polar, IMO > fig = figure(figsize=(8,8)) > ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True, axisbg='#d5de9c') > > z = np.zeros((1,2000),complex) > z.real = 0.2 > z.imag = np.arange(-50,50,0.05) > gamma_r = np.transpose((z-1)/(z+1)) > > ax.plot(np.angle(gamma_r), np.abs(gamma_r), '.-', zorder=0) Hi Jan, It looks like you get the circle because the angles you're plotting go from negative to positive radians in a weird way. The circle being drawn starts around 0 radians and goes clockwise by negative values. Then when it gets to - pi, it switches to positive indices, i.e. pi. Of course, these are the same points on a polar plot, but different angles, if you want to be consistent. Here are a couple of quick solutions, but there but there maybe better ways of handling this. # ~~ # get rid of the plot line above, and add the following theta = np.angle(gamma_r) mag = np.abs(gamma_r) # option 1 ordered = np.argsort(theta, axis=0).squeeze() ax.plot(theta[ordered], mag[ordered], '.-', zorder=0) # option 2 neg_theta = np.where(theta < 0) theta[neg_theta] += 2 * np.pi ax.plot(theta, mag, '.-', zorder=0) # ~~ I hope that's helpful, -Tony > > ax.set_rmax(2.0) > grid(True) > > show() > > > Kind regards, > Jean > > -- > Jan Gillis > Ghent University > IMEC vzw - INTEC > Sint-Pietersnieuwstraat 41 > B-9000 Gent > Belgium > tel. +32 9 264 33 33 > [EMAIL PROTECTED] > > > - > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win > great prizes > Grand prize is a trip for two to an Open Source event anywhere in > the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Information request
De Pauw Antoine wrote: > Jeff, > > I finally managed to obtain a neat image with imshow and griddata > > The code snippet is here: > http://snipplr.com/view/8307/map-plotting-python-code-temporary/ > > The only problem I have is now a grey line surrounding the plot, as you can > see in this low-res sample: > http://www.kirikoo.net/images/5shrad-20080917-151205.png > Antoine: Sorry, but I don't see it. > I have added zero-value points at the corners of the map, thinking that > interpolation simply didn't do its job between the points because of a lack > of data, but it's still the same > > The masked array has been replaced with a "replace by zero if superior to > -1.2" thing as the border was surrounding masked zone as well > > Is there a border to imshow? No. -Jeff > If yes, how to remove it? > > Also, I tried with aspect='auto' as it seemed to be there for that, but > still no progress > > Thanks for the tips and have a nice evening! > > Antoine De Pauw > Collaborateur de recherches, Informatique - Research collaborator, IT > Laboratoire de chimie quantique et photophysique - Quantum chemistry and > photophysics laboratory > Université Libre de Bruxelles - ULB > > > -Original Message- > From: Jeff Whitaker [mailto:[EMAIL PROTECTED] > Sent: mercredi 17 septembre 2008 13:40 > To: De Pauw Antoine > Cc: 'John Hunter'; 'Eric Firing'; 'Matplotlib Users' > Subject: Re: [Matplotlib-users] Information request > > De Pauw Antoine wrote: > >> Hi John, >> >> I used your example with the missing .ax to modify these font sizes and it >> works nicely >> >> Anyway, by investigation, I found that there is no way of interpolation >> using scattered data >> >> I tried to figure out how to grid my values and use imshow or pcolor, but >> with no success yet.. >> >> Could you explain me how I could do to grid, for example, that data: >> >> Lat[] (double array containing latitudes) >> Lon[] (double array containing longitudes) >> Val[] (double array containing values) >> >> Each of the arrays having the same size, and Val[1] has latitude Lat[1] >> > and > >> longitude Lon[1], and so on, and the coordinates are completely unordered >> >> When I try to use griddata and use imshow or pcolor with the output array, >> my figure is blank >> >> A simple example or guideline would do, I guess, as I've already gained a >> good knowledge of the language >> >> Thanks in advance >> >> PS: Here's the code snippet: >> http://snipplr.com/view/8307/map-plotting-python-code-temporary/ >> >> >> Antoine De Pauw >> Collaborateur de recherches, Informatique - Research collaborator, IT >> Laboratoire de chimie quantique et photophysique - Quantum chemistry and >> photophysics laboratory >> Université Libre de Bruxelles - ULB >> >> > > Antoine: Griddata should work fine. Your code snippet does not try to > use griddata, so I can't guess what is wrong. Let me suggest again - > please post complete, self-contained examples that demonstrate your > problem. > > Did you look at the griddata_demo.py example? > > -Jeff > > >> -Original Message- >> From: John Hunter [mailto:[EMAIL PROTECTED] >> Sent: mercredi 17 septembre 2008 13:00 >> To: De Pauw Antoine >> Cc: Eric Firing; Jeff Whitaker; Matplotlib Users >> Subject: Re: [Matplotlib-users] Information request >> >> On Wed, Sep 17, 2008 at 3:28 AM, De Pauw Antoine <[EMAIL PROTECTED]> >> > wrote: > >> >> >>> The image generated is here: >>> http://www.kirikoo.net/images/5shrad-20080917-102544.png >>> >>> Also, I couldn't find any way to reduce the colorbar font size >>> >>> >> The colorbar method returns a matplotlib.colorbar.Colorbar instance, >> which has matplotlib.axes.Axes instance stored as an attribute. Thus >> you can do: >> >> cb = colorbar(something) >> >> for t in cb.get_yticklabels(): >> t.set_fontsize(10) >> >> Eric: when you get some time, could you add docstrings to colorbar >> which document the publicly accessible attributes? >> >> JDH >> >> >> > > > -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX: (303)497-6449 NOAA/OAR/PSD R/PSD1Email : [EMAIL PROTECTED] 325 BroadwayOffice : Skaggs Research Cntr 1D-113 Boulder, CO, USA 80303-3328 Web: http://tinyurl.com/5telg - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] yaxis labels using subplot
Hi all, Actually this is more like two problems :-) I am trying to turn off the yaxis labels on the right hand side figure generated via subplot. After some trial and error it seems that I should be able to change these settings using the set command. For example you should be bale to do the following plot([1,2,3,4], [1,4,9,16]) set(gca(), 'xticks', [1,2,3,4]) as per the ipython instructions. However I have a complaint about the number of arguements (see below). This has been tried in a variety of ways, apart from a way that actually works. In [1]: plot([1,2,3,4], [1,4,9,16]) Out[1]: [] In [2]: set(gca(), 'xticks', [1,2,3,4]) --- Traceback (most recent call last) /home/stephens/Fe_profiles/20yr_SS_BATS/ in () : set expected at most 1 arguments, got 3 So i)does anybody know of an easy (/sucessful) way of turning off the rhs yaxis labels and ii) does anybody know why I am apparently having issues with putting more than one argument in the set command when, according to the help instructions, it should be possible. thanks in advance, nick stephens begin:vcard fn:Nicholas Stephens n:Stephens;Nicholas org:UMR CNRS 6539;Laboratoire des Sciences de l'Environnement Marin adr;quoted-printable;quoted-printable:Institut Universitaire Europ=C3=A9en de la Mer (IUEM), Place Nicolas Cope= rnic, Technop=C3=B4le Brest Iroise;;Laboratoire des Sciences de l'Environnement Marin ;Plouzan=C3=A9;;29280;Centre National de la Recherche Scientifique email;internet:[EMAIL PROTECTED] tel;work:+33(0)98498790 version:2.1 end:vcard - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Information request
Jeff, I finally managed to obtain a neat image with imshow and griddata The code snippet is here: http://snipplr.com/view/8307/map-plotting-python-code-temporary/ The only problem I have is now a grey line surrounding the plot, as you can see in this low-res sample: http://www.kirikoo.net/images/5shrad-20080917-151205.png I have added zero-value points at the corners of the map, thinking that interpolation simply didn't do its job between the points because of a lack of data, but it's still the same The masked array has been replaced with a "replace by zero if superior to -1.2" thing as the border was surrounding masked zone as well Is there a border to imshow? If yes, how to remove it? Also, I tried with aspect='auto' as it seemed to be there for that, but still no progress Thanks for the tips and have a nice evening! Antoine De Pauw Collaborateur de recherches, Informatique - Research collaborator, IT Laboratoire de chimie quantique et photophysique - Quantum chemistry and photophysics laboratory Université Libre de Bruxelles - ULB -Original Message- From: Jeff Whitaker [mailto:[EMAIL PROTECTED] Sent: mercredi 17 septembre 2008 13:40 To: De Pauw Antoine Cc: 'John Hunter'; 'Eric Firing'; 'Matplotlib Users' Subject: Re: [Matplotlib-users] Information request De Pauw Antoine wrote: > Hi John, > > I used your example with the missing .ax to modify these font sizes and it > works nicely > > Anyway, by investigation, I found that there is no way of interpolation > using scattered data > > I tried to figure out how to grid my values and use imshow or pcolor, but > with no success yet.. > > Could you explain me how I could do to grid, for example, that data: > > Lat[] (double array containing latitudes) > Lon[] (double array containing longitudes) > Val[] (double array containing values) > > Each of the arrays having the same size, and Val[1] has latitude Lat[1] and > longitude Lon[1], and so on, and the coordinates are completely unordered > > When I try to use griddata and use imshow or pcolor with the output array, > my figure is blank > > A simple example or guideline would do, I guess, as I've already gained a > good knowledge of the language > > Thanks in advance > > PS: Here's the code snippet: > http://snipplr.com/view/8307/map-plotting-python-code-temporary/ > > > Antoine De Pauw > Collaborateur de recherches, Informatique - Research collaborator, IT > Laboratoire de chimie quantique et photophysique - Quantum chemistry and > photophysics laboratory > Université Libre de Bruxelles - ULB > Antoine: Griddata should work fine. Your code snippet does not try to use griddata, so I can't guess what is wrong. Let me suggest again - please post complete, self-contained examples that demonstrate your problem. Did you look at the griddata_demo.py example? -Jeff > > -Original Message- > From: John Hunter [mailto:[EMAIL PROTECTED] > Sent: mercredi 17 septembre 2008 13:00 > To: De Pauw Antoine > Cc: Eric Firing; Jeff Whitaker; Matplotlib Users > Subject: Re: [Matplotlib-users] Information request > > On Wed, Sep 17, 2008 at 3:28 AM, De Pauw Antoine <[EMAIL PROTECTED]> wrote: > > >> The image generated is here: >> http://www.kirikoo.net/images/5shrad-20080917-102544.png >> >> Also, I couldn't find any way to reduce the colorbar font size >> > > The colorbar method returns a matplotlib.colorbar.Colorbar instance, > which has matplotlib.axes.Axes instance stored as an attribute. Thus > you can do: > > cb = colorbar(something) > > for t in cb.get_yticklabels(): > t.set_fontsize(10) > > Eric: when you get some time, could you add docstrings to colorbar > which document the publicly accessible attributes? > > JDH > > -- Jeffrey S. Whitaker Phone : (303)497-6313 NOAA/OAR/CDC R/PSD1FAX : (303)497-6449 325 BroadwayBoulder, CO, USA 80305-3328 - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Information request
Jeff, Sorry, I have forgotten to add this piece of code since I'm continually adding/removing bits This code comes instead of the scatter method and colorbar things: xi=np.linspace(-180,180,360) yi=np.linspace(-90,90,180) zi=griddata(Lon,Lat,Val_masked,xi,yi) Is it done the good way? If it is, what's the best method to display it with interpolation? Antoine De Pauw Collaborateur de recherches, Informatique - Research collaborator, IT Laboratoire de chimie quantique et photophysique - Quantum chemistry and photophysics laboratory Université Libre de Bruxelles - ULB -Original Message- From: Jeff Whitaker [mailto:[EMAIL PROTECTED] Sent: mercredi 17 septembre 2008 13:40 To: De Pauw Antoine Cc: 'John Hunter'; 'Eric Firing'; 'Matplotlib Users' Subject: Re: [Matplotlib-users] Information request De Pauw Antoine wrote: > Hi John, > > I used your example with the missing .ax to modify these font sizes and it > works nicely > > Anyway, by investigation, I found that there is no way of interpolation > using scattered data > > I tried to figure out how to grid my values and use imshow or pcolor, but > with no success yet.. > > Could you explain me how I could do to grid, for example, that data: > > Lat[] (double array containing latitudes) > Lon[] (double array containing longitudes) > Val[] (double array containing values) > > Each of the arrays having the same size, and Val[1] has latitude Lat[1] and > longitude Lon[1], and so on, and the coordinates are completely unordered > > When I try to use griddata and use imshow or pcolor with the output array, > my figure is blank > > A simple example or guideline would do, I guess, as I've already gained a > good knowledge of the language > > Thanks in advance > > PS: Here's the code snippet: > http://snipplr.com/view/8307/map-plotting-python-code-temporary/ > > > Antoine De Pauw > Collaborateur de recherches, Informatique - Research collaborator, IT > Laboratoire de chimie quantique et photophysique - Quantum chemistry and > photophysics laboratory > Université Libre de Bruxelles - ULB > Antoine: Griddata should work fine. Your code snippet does not try to use griddata, so I can't guess what is wrong. Let me suggest again - please post complete, self-contained examples that demonstrate your problem. Did you look at the griddata_demo.py example? -Jeff > > -Original Message- > From: John Hunter [mailto:[EMAIL PROTECTED] > Sent: mercredi 17 septembre 2008 13:00 > To: De Pauw Antoine > Cc: Eric Firing; Jeff Whitaker; Matplotlib Users > Subject: Re: [Matplotlib-users] Information request > > On Wed, Sep 17, 2008 at 3:28 AM, De Pauw Antoine <[EMAIL PROTECTED]> wrote: > > >> The image generated is here: >> http://www.kirikoo.net/images/5shrad-20080917-102544.png >> >> Also, I couldn't find any way to reduce the colorbar font size >> > > The colorbar method returns a matplotlib.colorbar.Colorbar instance, > which has matplotlib.axes.Axes instance stored as an attribute. Thus > you can do: > > cb = colorbar(something) > > for t in cb.get_yticklabels(): > t.set_fontsize(10) > > Eric: when you get some time, could you add docstrings to colorbar > which document the publicly accessible attributes? > > JDH > > -- Jeffrey S. Whitaker Phone : (303)497-6313 NOAA/OAR/CDC R/PSD1FAX : (303)497-6449 325 BroadwayBoulder, CO, USA 80305-3328 - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Information request
De Pauw Antoine wrote: > Hi John, > > I used your example with the missing .ax to modify these font sizes and it > works nicely > > Anyway, by investigation, I found that there is no way of interpolation > using scattered data > > I tried to figure out how to grid my values and use imshow or pcolor, but > with no success yet.. > > Could you explain me how I could do to grid, for example, that data: > > Lat[] (double array containing latitudes) > Lon[] (double array containing longitudes) > Val[] (double array containing values) > > Each of the arrays having the same size, and Val[1] has latitude Lat[1] and > longitude Lon[1], and so on, and the coordinates are completely unordered > > When I try to use griddata and use imshow or pcolor with the output array, > my figure is blank > > A simple example or guideline would do, I guess, as I've already gained a > good knowledge of the language > > Thanks in advance > > PS: Here's the code snippet: > http://snipplr.com/view/8307/map-plotting-python-code-temporary/ > > > Antoine De Pauw > Collaborateur de recherches, Informatique - Research collaborator, IT > Laboratoire de chimie quantique et photophysique - Quantum chemistry and > photophysics laboratory > Université Libre de Bruxelles - ULB > Antoine: Griddata should work fine. Your code snippet does not try to use griddata, so I can't guess what is wrong. Let me suggest again - please post complete, self-contained examples that demonstrate your problem. Did you look at the griddata_demo.py example? -Jeff > > -Original Message- > From: John Hunter [mailto:[EMAIL PROTECTED] > Sent: mercredi 17 septembre 2008 13:00 > To: De Pauw Antoine > Cc: Eric Firing; Jeff Whitaker; Matplotlib Users > Subject: Re: [Matplotlib-users] Information request > > On Wed, Sep 17, 2008 at 3:28 AM, De Pauw Antoine <[EMAIL PROTECTED]> wrote: > > >> The image generated is here: >> http://www.kirikoo.net/images/5shrad-20080917-102544.png >> >> Also, I couldn't find any way to reduce the colorbar font size >> > > The colorbar method returns a matplotlib.colorbar.Colorbar instance, > which has matplotlib.axes.Axes instance stored as an attribute. Thus > you can do: > > cb = colorbar(something) > > for t in cb.get_yticklabels(): > t.set_fontsize(10) > > Eric: when you get some time, could you add docstrings to colorbar > which document the publicly accessible attributes? > > JDH > > -- Jeffrey S. Whitaker Phone : (303)497-6313 NOAA/OAR/CDC R/PSD1FAX : (303)497-6449 325 BroadwayBoulder, CO, USA 80305-3328 - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Information request
Hi John, I used your example with the missing .ax to modify these font sizes and it works nicely Anyway, by investigation, I found that there is no way of interpolation using scattered data I tried to figure out how to grid my values and use imshow or pcolor, but with no success yet.. Could you explain me how I could do to grid, for example, that data: Lat[] (double array containing latitudes) Lon[] (double array containing longitudes) Val[] (double array containing values) Each of the arrays having the same size, and Val[1] has latitude Lat[1] and longitude Lon[1], and so on, and the coordinates are completely unordered When I try to use griddata and use imshow or pcolor with the output array, my figure is blank A simple example or guideline would do, I guess, as I've already gained a good knowledge of the language Thanks in advance PS: Here's the code snippet: http://snipplr.com/view/8307/map-plotting-python-code-temporary/ Antoine De Pauw Collaborateur de recherches, Informatique - Research collaborator, IT Laboratoire de chimie quantique et photophysique - Quantum chemistry and photophysics laboratory Université Libre de Bruxelles - ULB -Original Message- From: John Hunter [mailto:[EMAIL PROTECTED] Sent: mercredi 17 septembre 2008 13:00 To: De Pauw Antoine Cc: Eric Firing; Jeff Whitaker; Matplotlib Users Subject: Re: [Matplotlib-users] Information request On Wed, Sep 17, 2008 at 3:28 AM, De Pauw Antoine <[EMAIL PROTECTED]> wrote: > The image generated is here: > http://www.kirikoo.net/images/5shrad-20080917-102544.png > > Also, I couldn't find any way to reduce the colorbar font size The colorbar method returns a matplotlib.colorbar.Colorbar instance, which has matplotlib.axes.Axes instance stored as an attribute. Thus you can do: cb = colorbar(something) for t in cb.get_yticklabels(): t.set_fontsize(10) Eric: when you get some time, could you add docstrings to colorbar which document the publicly accessible attributes? JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Information request
On Wed, Sep 17, 2008 at 3:28 AM, De Pauw Antoine <[EMAIL PROTECTED]> wrote: > The image generated is here: > http://www.kirikoo.net/images/5shrad-20080917-102544.png > > Also, I couldn't find any way to reduce the colorbar font size The colorbar method returns a matplotlib.colorbar.Colorbar instance, which has matplotlib.axes.Axes instance stored as an attribute. Thus you can do: cb = colorbar(something) for t in cb.get_yticklabels(): t.set_fontsize(10) Eric: when you get some time, could you add docstrings to colorbar which document the publicly accessible attributes? JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Information request
Eric, I solved the problem by using vmin/vmax, masking and the heat colorbar That choice is then "self-masking" for undesired pixels left after masking and vmin/vmax Now the thing I still have to do is smoothing scattered data, after that I'll implement it with GTK or any other windowing system and when it is finished I'll provide it to the community for example purpose In fact I'm not demanding for code or so, but for method names which could help me do what I need, with code examples for instance The source code is the same as the one posted initially in that mail, except the masked array which is, I think, straightforward for most of you Now I have scattered data on my map, antialiased and so, but it still needs some smoothing as it still looks very pixelated (that is due to the satellite coverage) The image generated is here: http://www.kirikoo.net/images/5shrad-20080917-102544.png Also, I couldn't find any way to reduce the colorbar font size Do you know of any ways to achieve these goals? Antoine De Pauw Collaborateur de recherches, Informatique - Research collaborator, IT Laboratoire de chimie quantique et photophysique - Quantum chemistry and photophysics laboratory Université Libre de Bruxelles - ULB -Original Message- From: Eric Firing [mailto:[EMAIL PROTECTED] Sent: mardi 16 septembre 2008 21:58 To: De Pauw Antoine Cc: 'Jeff Whitaker'; 'Matplotlib Users' Subject: Re: [Matplotlib-users] Information request De Pauw Antoine wrote: > Jeff, > > In fact my satellite data is displaying clouds of various gases, and I dont > like the fact that "empty" places are left dark blue (I use jet reversed > cmap) > > By masking data under a certain value, I isolate the clouds and then they > are in evidence > > When I use vmin and vmax I'm able to avoid the colormap rescaling and I keep > the cloud's original colour, but then it is the colorbar which poses > problems, as there's a part of the bar that is useless Can you provide a compact example script, completely self-contained, that illustrates the problem with the colorbar? Perhaps by modifying one of the standard mpl examples, such as image_masked.py? From what you have said, I would expect that some combination of masking, using vmin and vmax, and using the special value colors, would work adequately with the present colorbar. Eric - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users