From: Gökhan S. <gok...@gm...> - 2011-02-11 16:10:43
|
Hi, I see two related requests on: http://old.nabble.com/matplotlib-to-draw-streamlines--td28008708.html http://www.mail-archive.com/mat...@li.../msg07267.html a request filed on http://sourceforge.net/tracker/index.php?func=detail&aid=3080981&group_id=80706&atid=560723 Is there any progress on this plot? Or source guides to implement such functionality in mpl? PS: The feature request @ http://sourceforge.net/tracker/?atid=560723&group_id=80706&func=browse looks spammed? Anyone works on clearing these? -- Gökhan |
From: Jeff W. <js...@fa...> - 2011-02-11 16:45:48
|
On 2/11/11 9:10 AM, Gökhan Sever wrote: > Hi, > I see two related requests on: > http://old.nabble.com/matplotlib-to-draw-streamlines--td28008708.html > http://www.mail-archive.com/mat...@li.../msg07267.html > a request filed on > http://sourceforge.net/tracker/index.php?func=detail&aid=3080981&group_id=80706&atid=560723 > <http://sourceforge.net/tracker/index.php?func=detail&aid=3080981&group_id=80706&atid=560723> > Is there any progress on this plot? Or source guides to implement such > functionality in mpl? > PS: The feature request @ > http://sourceforge.net/tracker/?atid=560723&group_id=80706&func=browse > <http://sourceforge.net/tracker/?atid=560723&group_id=80706&func=browse> looks > spammed? Anyone works on clearing these? > > -- > Gökhan Gökhan: Nobody is working on that as far as I know. An interesting alternative to streamlines can be found here: http://scikits.appspot.com/vectorplot -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX : (303)497-6449 NOAA/OAR/PSD R/PSD1 Email : Jef...@no... 325 Broadway Office : Skaggs Research Cntr 1D-113 Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg |
From: Jeff W. <js...@fa...> - 2011-02-11 20:16:29
|
On 2/11/11 9:45 AM, Jeff Whitaker wrote: > On 2/11/11 9:10 AM, Gökhan Sever wrote: >> Hi, >> I see two related requests on: >> http://old.nabble.com/matplotlib-to-draw-streamlines--td28008708.html >> http://www.mail-archive.com/mat...@li.../msg07267.html >> a request filed on >> http://sourceforge.net/tracker/index.php?func=detail&aid=3080981&group_id=80706&atid=560723 >> <http://sourceforge.net/tracker/index.php?func=detail&aid=3080981&group_id=80706&atid=560723> >> Is there any progress on this plot? Or source guides to implement such >> functionality in mpl? >> PS: The feature request @ >> http://sourceforge.net/tracker/?atid=560723&group_id=80706&func=browse >> <http://sourceforge.net/tracker/?atid=560723&group_id=80706&func=browse> looks >> spammed? Anyone works on clearing these? >> >> -- >> Gökhan > Gökhan: Nobody is working on that as far as I know. An interesting > alternative to streamlines can be found here: > > http://scikits.appspot.com/vectorplot > > -Jeff > > Gökhan: I just added a lic_demo.py example to basemap SVN that shows how to use the vectorplot scikit with basemap (image as http://jswhit.fastmail.fm/lic_demo.png). Is this the sort of thing you were looking for? -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX : (303)497-6449 NOAA/OAR/PSD R/PSD1 Email : Jef...@no... 325 Broadway Office : Skaggs Research Cntr 1D-113 Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg |
From: Ray S. <sp...@MI...> - 2011-02-11 21:06:14
|
Hi, I wrote a script to generate streamline plots using matplotlib a while ago, and this post inspired me to finally clean it up a bit. The code is available at http://web.mit.edu/speth/Public/streamlines.py and you can see an example of its output at http://web.mit.edu/speth/Public/streamlines.png I'd be happy to have it find a home in matplotlib if it would be useful to other people there. Ray On 02/11/2011 11:10 AM, Gökhan Sever wrote: > Hi, > I see two related requests on: > http://old.nabble.com/matplotlib-to-draw-streamlines--td28008708.html > http://www.mail-archive.com/mat...@li.../msg07267.html > a request filed on > http://sourceforge.net/tracker/index.php?func=detail&aid=3080981&group_id=80706&atid=560723 > <http://sourceforge.net/tracker/index.php?func=detail&aid=3080981&group_id=80706&atid=560723> > Is there any progress on this plot? Or source guides to implement such > functionality in mpl? > PS: The feature request @ > http://sourceforge.net/tracker/?atid=560723&group_id=80706&func=browse > <http://sourceforge.net/tracker/?atid=560723&group_id=80706&func=browse> looks > spammed? Anyone works on clearing these? > > -- > Gökhan > > > > ------------------------------------------------------------------------------ > The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: > Pinpoint memory and threading errors before they happen. > Find and fix more than 250 security defects in the development cycle. > Locate bottlenecks in serial and parallel code that limit performance. > http://p.sf.net/sfu/intel-dev2devfeb > > > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
From: Jason G. <jas...@cr...> - 2011-02-12 20:26:31
|
On 2/11/11 3:06 PM, Ray Speth wrote: > Hi, > > I wrote a script to generate streamline plots using matplotlib a while > ago, and this post inspired me to finally clean it up a bit. The code is > available at http://web.mit.edu/speth/Public/streamlines.py and you can > see an example of its output at > http://web.mit.edu/speth/Public/streamlines.png > > I'd be happy to have it find a home in matplotlib if it would be useful > to other people there. Could you put a license statement on the file you posted? Even if it isn't included in matplotlib, I think we would love to include it in Sage. I've wanted to have streamline plots in Sage for a long time, and your plots look great! Thanks, Jason |
From: Benjamin R. <ben...@ou...> - 2011-02-12 18:02:19
|
On Fri, Feb 11, 2011 at 3:06 PM, Ray Speth <sp...@mi...> wrote: > Hi, > > I wrote a script to generate streamline plots using matplotlib a while > ago, and this post inspired me to finally clean it up a bit. The code is > available at http://web.mit.edu/speth/Public/streamlines.py and you can > see an example of its output at > http://web.mit.edu/speth/Public/streamlines.png > > I'd be happy to have it find a home in matplotlib if it would be useful > to other people there. > > Ray > > Ray, That is absolutely beautiful work there. At the very least, I would like to see this added to the gallery or the cookbook. The code is very nicely commented and documented. Just a few points that come to mind. First, consider the possibility of using asanyarray() instead of asarray(). The big usecase for asanyarray is the use of masked arrays. Second, I am personally against call signatures that are just "**kwargs" and then popping off the arguments at the beginning of the method. So long as the default value is not a mutable object, then put those arguments in the call signature with the default values. It is much more IDE and documentation-friendly this way. Third, I would think that using plt.gca() would be better than plt.axes() just in case the user is using subplots. gca() will create an axes if none exists already. Lastly, you should do ax.plot() instead of plt.plot() since you have already retrieved the axes object. This way, in case the axes object passed in is not the currently active axes, it would still work. The difficulty in getting this included into matplotlib proper (and the same goes to the other thread about streamgraphs) is that these plots are done in an object oriented rather than procedural approach. Personally, I would like to see (one day) a refactor of matplotlib where everything plotable is an object that gets placed into the axes object (which, itself is a plotable that gets placed in a figure...). While the current code isn't too far from that concept, the interface is ultimately procedural. @everyone else: The big reason I see for a future refactor to an object-oriented approach is that plots are getting more complicated, and we can't just keep on adding more methods to the axes object. A more object-oriented approach would allow for complex graphs to be placed into their own modules, and yet still be treated the same as any other plotting method. It would also make it easier for others to extend matplotlib's plotting features. Ben Root |
From: Ray S. <sp...@MI...> - 2011-02-13 04:00:59
|
Ben, Thanks for the suggestions. I've updated the code accordingly. I tend to use **kwargs because it enforces passing arguments in by keyword, but your point on IDE friendliness is well taken. Someday, we'll move to Python 3 with its support for keyword-only arguments... I've also added a license block releasing the code under the MIT license. If there's a reason it should be released under a different license as well, let me know. Ray On 2/12/2011 1:01 PM, Benjamin Root wrote: > > > On Fri, Feb 11, 2011 at 3:06 PM, Ray Speth <sp...@mi... > <mailto:sp...@mi...>> wrote: > > Hi, > > I wrote a script to generate streamline plots using matplotlib a while > ago, and this post inspired me to finally clean it up a bit. The code is > available at http://web.mit.edu/speth/Public/streamlines.py and you can > see an example of its output at > http://web.mit.edu/speth/Public/streamlines.png > > I'd be happy to have it find a home in matplotlib if it would be useful > to other people there. > > Ray > > > Ray, > > That is absolutely beautiful work there. > > At the very least, I would like to see this added to the gallery or the > cookbook. The code is very nicely commented and documented. Just a few > points that come to mind. > > First, consider the possibility of using asanyarray() instead of > asarray(). The big usecase for asanyarray is the use of masked arrays. > > Second, I am personally against call signatures that are just "**kwargs" > and then popping off the arguments at the beginning of the method. So > long as the default value is not a mutable object, then put those > arguments in the call signature with the default values. It is much > more IDE and documentation-friendly this way. > > Third, I would think that using plt.gca() would be better than > plt.axes() just in case the user is using subplots. gca() will create > an axes if none exists already. > > Lastly, you should do ax.plot() instead of plt.plot() since you have > already retrieved the axes object. This way, in case the axes object > passed in is not the currently active axes, it would still work. > > The difficulty in getting this included into matplotlib proper (and the > same goes to the other thread about streamgraphs) is that these plots > are done in an object oriented rather than procedural approach. > Personally, I would like to see (one day) a refactor of matplotlib where > everything plotable is an object that gets placed into the axes object > (which, itself is a plotable that gets placed in a figure...). While > the current code isn't too far from that concept, the interface is > ultimately procedural. > > @everyone else: > The big reason I see for a future refactor to an object-oriented > approach is that plots are getting more complicated, and we can't just > keep on adding more methods to the axes object. A more object-oriented > approach would allow for complex graphs to be placed into their own > modules, and yet still be treated the same as any other plotting > method. It would also make it easier for others to extend matplotlib's > plotting features. > > Ben Root > |
From: Tom F. <tj...@ca...> - 2011-02-14 05:50:20
|
Hi, I've written a script to roughly emulate the elegant streamline plots found in Mathematica. The code is available at http://www.atm.damtp.cam.ac.uk/people/tjf37/streamplot.py and example plots at http://www.atm.damtp.cam.ac.uk/people/tjf37/streamlines1.png and streamlines2.png. It's a pretty hacky script, but fast and fairly robust. If anyone finds this script useful and has comments/suggestions, I'm happy to do a bit more work. It would also be helpful if anyone has suggestions on a particular issue I had. Currently, to plot variable-width lines (i.e. streamlines2.png) I use a plot command for each line segment which is very slow and nasty. Is there a better way I'm missing? Tom |
From: Jeff W. <js...@fa...> - 2011-02-14 23:04:55
|
On 2/13/11 10:45 PM, Tom Flannaghan wrote: > Hi, > > I've written a script to roughly emulate the elegant streamline plots found in > Mathematica. The code is available at > http://www.atm.damtp.cam.ac.uk/people/tjf37/streamplot.py and example plots at > http://www.atm.damtp.cam.ac.uk/people/tjf37/streamlines1.png and > streamlines2.png. It's a pretty hacky script, but fast and fairly robust. If > anyone finds this script useful and has comments/suggestions, I'm happy to do a > bit more work. > > It would also be helpful if anyone has suggestions on a particular issue I had. > Currently, to plot variable-width lines (i.e. streamlines2.png) I use a plot > command for each line segment which is very slow and nasty. Is there a better > way I'm missing? > > Tom Tom: This is really nice! I'd like to see some version of your code incorporated into matplotlib. Regarding your question about variable-width lines, I don't know of any way to do that - but perhaps someone with more detailed knowledge of matplotlib internals will comment. -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX : (303)497-6449 NOAA/OAR/PSD R/PSD1 Email : Jef...@no... 325 Broadway Office : Skaggs Research Cntr 1D-113 Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg |
From: John H. <jd...@gm...> - 2011-02-14 23:31:09
|
On Sun, Feb 13, 2011 at 11:45 PM, Tom Flannaghan <tj...@ca...> wrote: > It would also be helpful if anyone has suggestions on a particular issue I had. > Currently, to plot variable-width lines (i.e. streamlines2.png) I use a plot > command for each line segment which is very slow and nasty. Is there a better > way I'm missing? You probably want to use a compound path (one object for the entire plot). See the tutorial at http://matplotlib.sourceforge.net/users/path_tutorial.html, in particular the compound path for the histogram example near the end, and let me know if you have any questions. JDH |
From: Benjamin R. <ben...@ou...> - 2011-02-14 23:55:00
|
On Mon, Feb 14, 2011 at 5:30 PM, John Hunter <jd...@gm...> wrote: > On Sun, Feb 13, 2011 at 11:45 PM, Tom Flannaghan <tj...@ca...> wrote: > > > It would also be helpful if anyone has suggestions on a particular issue > I had. > > Currently, to plot variable-width lines (i.e. streamlines2.png) I use a > plot > > command for each line segment which is very slow and nasty. Is there a > better > > way I'm missing? > > You probably want to use a compound path (one object for the entire > plot). See the tutorial at > http://matplotlib.sourceforge.net/users/path_tutorial.html, in > particular the compound path for the histogram example near the end, > and let me know if you have any questions. > > JDH > > Personally, I am more a fan of Ray's version, although Tom's version would integrate more nicely with the current mpl codebase. There are some nice features with Ray's version such as allowing to choose density in both x and y directions. I guess the major question is which style do we like better? Maybe we could use both of these code bases to come up with a nice, generalized version? Ben Root |
From: Jeff W. <js...@fa...> - 2011-02-15 15:45:41
|
On 2/14/11 4:54 PM, Benjamin Root wrote: > On Mon, Feb 14, 2011 at 5:30 PM, John Hunter <jd...@gm... > <mailto:jd...@gm...>> wrote: > > On Sun, Feb 13, 2011 at 11:45 PM, Tom Flannaghan <tj...@ca... > <mailto:tj...@ca...>> wrote: > > > It would also be helpful if anyone has suggestions on a > particular issue I had. > > Currently, to plot variable-width lines (i.e. streamlines2.png) > I use a plot > > command for each line segment which is very slow and nasty. Is > there a better > > way I'm missing? > > You probably want to use a compound path (one object for the entire > plot). See the tutorial at > http://matplotlib.sourceforge.net/users/path_tutorial.html, in > particular the compound path for the histogram example near the end, > and let me know if you have any questions. > > JDH > > > Personally, I am more a fan of Ray's version, although Tom's version > would integrate more nicely with the current mpl codebase. There are > some nice features with Ray's version such as allowing to choose > density in both x and y directions. > > I guess the major question is which style do we like better? Maybe we > could use both of these code bases to come up with a nice, generalized > version? > > Ben Root > Ben, John: Later this week or next, I'll take a crack at adding both of these to quiver.py and axes.py (one under the name "streamlines", the other as "streamplot"). -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX : (303)497-6449 NOAA/OAR/PSD R/PSD1 Email : Jef...@no... 325 Broadway Office : Skaggs Research Cntr 1D-113 Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg |
From: Tom F. <tj...@ca...> - 2011-02-16 14:48:29
|
> Ben, John: Later this week or next, I'll take a crack at adding both of these to quiver.py and > axes.py (one under the name "streamlines", the other as "streamplot"). This is a great idea. I've had some time to improve the code, and so you have something better to work with! If you have any questions or need the code modifying, I'm happy to help - should have free time at the weekend and next week. I've also added density in both directions (nice idea - hadn't thought about this) and variable color as well as width. The new code is at http://www.atm.damtp.cam.ac.uk/people/tjf37/streamplot.py and there are new sample plots at http://www.atm.damtp.cam.ac.uk/people/tjf37/streamlines1.png and http://www.atm.damtp.cam.ac.uk/people/tjf37/streamlines2.png . > You probably want to use a compound path (one object for the entire > plot). See the tutorial athttp://matplotlib.sourceforge.net/users/path_tutorial.html, in > particular the compound path for the histogram example near the end, > and let me know if you have any questions. John, thanks for the hints. In the end I used a LineCollection for each streamline because I didn't see how to set different properties (colour and width) for different portions of the line in the compound path. LineCollection performs well enough for this plot so I'm happy with this solution. Tom |