Discussion:
[Matplotlib-users] matplotlib basemap streamlines plot
Sappy85
2015-03-27 14:01:52 UTC
Permalink
Hi all,

tried to plot a streamline with matplotlib. So far it work's.
But my question: Is there a possibility to avoid the gaps in the streamlines
(see my picture)?

<Loading Image...>

Regards
Sappy85





--
View this message in context: http://matplotlib.1069221.n5.nabble.com/matplotlib-basemap-streamlines-plot-tp45276.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
Foehn
2015-03-30 19:15:13 UTC
Permalink
Post by Sappy85
Hi all,
tried to plot a streamline with matplotlib. So far it work's.
But my question: Is there a possibility to avoid the gaps in the streamlines
(see my picture)?
<http://matplotlib.1069221.n5.nabble.com/file/n45276/ff850_0.png>
Are you sure your flow is non divergent? Otherwise sinks and sources of
streamlines are quite natural. If your flow is divergence free I I
frankly admit that I have no idea how to solve the problem with the
(then) spurious gaps.

Regards, Foehn
Post by Sappy85
Regards
Sappy85
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/matplotlib-basemap-streamlines-plot-tp45276.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Matplotlib-users mailing list
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Tony Yu
2015-03-31 03:26:10 UTC
Permalink
Post by Sappy85
Post by Sappy85
Hi all,
tried to plot a streamline with matplotlib. So far it work's.
But my question: Is there a possibility to avoid the gaps in the
streamlines
Post by Sappy85
(see my picture)?
I think the problem is that the streamline algorithm doesn't make any
attempt to optimize for longer streamlines. It's been a long time since
I've looked at the code, but roughly speaking, the algorithm optimizes for
spacing between streamlines. Reducing the `minlength` input *should*
slightly prefer longer streamlines, but you'll see side-effects with lines
near borders and diverging flows.

If changing the `streamplot` implementation is an option, one of the
simpler ways to achieve streamlines with fewer gaps would be allow the grid
of starting points to vary independently from the grid that determines that
streamlines are "too close". There are also "smarter" ways of seeding the
streamlines, but that would be a bit more work, I believe.

-Tony
Post by Sappy85
Post by Sappy85
<http://matplotlib.1069221.n5.nabble.com/file/n45276/ff850_0.png>
Are you sure your flow is non divergent? Otherwise sinks and sources of
streamlines are quite natural. If your flow is divergence free I I
frankly admit that I have no idea how to solve the problem with the
(then) spurious gaps.
Regards, Foehn
Post by Sappy85
Regards
Sappy85
--
http://matplotlib.1069221.n5.nabble.com/matplotlib-basemap-streamlines-plot-tp45276.html
Jody Klymak
2015-03-31 03:59:41 UTC
Permalink
Hi,

If your flow is actually non-divergent, so that continuous streamlines make sense, you could contour the streamfunction: a decent approximation should be
psi = 0.5*( cumsum(u*dy[:,newaxis],axis=1)-cumsum(v*dx[newaxis,:],axis=0))

Of course this won’t work so well if u and v are coarsely spaced or divergent...

Cheers, Jody
Post by Sappy85
Hi all,
tried to plot a streamline with matplotlib. So far it work's.
But my question: Is there a possibility to avoid the gaps in the streamlines
(see my picture)?
I think the problem is that the streamline algorithm doesn't make any attempt to optimize for longer streamlines. It's been a long time since I've looked at the code, but roughly speaking, the algorithm optimizes for spacing between streamlines. Reducing the `minlength` input *should* slightly prefer longer streamlines, but you'll see side-effects with lines near borders and diverging flows.
If changing the `streamplot` implementation is an option, one of the simpler ways to achieve streamlines with fewer gaps would be allow the grid of starting points to vary independently from the grid that determines that streamlines are "too close". There are also "smarter" ways of seeding the streamlines, but that would be a bit more work, I believe.
-Tony
Post by Sappy85
<http://matplotlib.1069221.n5.nabble.com/file/n45276/ff850_0.png <http://matplotlib.1069221.n5.nabble.com/file/n45276/ff850_0.png>>
Are you sure your flow is non divergent? Otherwise sinks and sources of
streamlines are quite natural. If your flow is divergence free I I
frankly admit that I have no idea how to solve the problem with the
(then) spurious gaps.
Regards, Foehn
Post by Sappy85
Regards
Sappy85
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/matplotlib-basemap-streamlines-plot-tp45276.html <http://matplotlib.1069221.n5.nabble.com/matplotlib-basemap-streamlines-plot-tp45276.html>
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/_______________________________________________
Matplotlib-users mailing list
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Loading...