Any update on streamline plot

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

···

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

--
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jeffrey.S.Whitaker@...259...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg

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

···

On Sun, Feb 13, 2011 at 11:45 PM, Tom Flannaghan <tjf37@...776...> 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?

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

···

On Mon, Feb 14, 2011 at 5:30 PM, John Hunter <jdh2358@…287…> wrote:

On Sun, Feb 13, 2011 at 11:45 PM, Tom Flannaghan <tjf37@…776…> 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

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 : 325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web :

Jeffrey.S.Whitaker@…259…http://tinyurl.com/5telg