You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[ENH]: A function for computing and displaying 3D streamline? #26539
Worth adding a function for computing and displaying 3D stream plots?
A 3D version of the streamline plot function pyplot.streamplot would display the streamlines in 3D vector fields. This is doable in Matplotlib by computing everything beforehand and displaying the results in 3D, but it would be a lot simpler if Matplotlib had a function that does everything. This function would be especially useful for displaying magnetic field streamlines in 3D.
I'm a little uncomfortable with how we are currently abstracting away all the streamline calculations - there's a lot of nuance about integrator settings that we are brushing under the rug. For example I think using only a 2nd order runge-kutta method right now for integration is a bit of a questionable choice, as is using a linear interpolator, and boundary conditions aren't configurable at all. But the very nature & sparsity of a streamline plot does suggest that it's just an approximate visualization, so maybe this is fine. Shouldn't preclude adding in a basic implementation in any case.
I would start with an external package for this, and then we can see if we can work it in. In particular I would be much more concerned about speed and how to make it look reasonable than accuracy.
@jklymak do you know of an external package for this? I did a quick search but couldn’t find anything. If I recall correctly how it worked with the contour package we pull in, that it started in matplotlib and split off after it got to a point of high enough maturity.
I meant I would suggest writing an external package.
contouring was split off because it is a more general problem than just Matplotlib, and now other libraries can use it. If we were doing it again, I suspect we would have started out that way. Similarly here - calculating streamlines is complex, and somewhat dependent on the underlying physics, so developing the code outside of Matplotlib may make sense, and then we could make it a dependency eventually if there is a simple API that can be used.
I need a function to draw ternary streamplot. I know a package python-ternary can draw ternary diagrams, but it can't draw stream plot. Can anyone help me?
Activity
scottshambaugh commentedon Aug 17, 2023
Definitely useful! I think we would need us to think about how best to tie this in with the 2D implementation in https://github.com/matplotlib/matplotlib/blob/main/lib/matplotlib/streamplot.py
I'm a little uncomfortable with how we are currently abstracting away all the streamline calculations - there's a lot of nuance about integrator settings that we are brushing under the rug. For example I think using only a 2nd order runge-kutta method right now for integration is a bit of a questionable choice, as is using a linear interpolator, and boundary conditions aren't configurable at all. But the very nature & sparsity of a streamline plot does suggest that it's just an approximate visualization, so maybe this is fine. Shouldn't preclude adding in a basic implementation in any case.
jklymak commentedon Aug 17, 2023
I would start with an external package for this, and then we can see if we can work it in. In particular I would be much more concerned about speed and how to make it look reasonable than accuracy.
scottshambaugh commentedon Aug 17, 2023
@jklymak do you know of an external package for this? I did a quick search but couldn’t find anything. If I recall correctly how it worked with the contour package we pull in, that it started in matplotlib and split off after it got to a point of high enough maturity.
jklymak commentedon Aug 17, 2023
I meant I would suggest writing an external package.
contouring was split off because it is a more general problem than just Matplotlib, and now other libraries can use it. If we were doing it again, I suspect we would have started out that way. Similarly here - calculating streamlines is complex, and somewhat dependent on the underlying physics, so developing the code outside of Matplotlib may make sense, and then we could make it a dependency eventually if there is a simple API that can be used.
haricash commentedon Nov 21, 2023
Seconding this - I would love a 3D streamplot feature for Matplotlib. Is there any work being done in this direction?
Gritbadger commentedon Nov 29, 2023
I need a function to draw ternary streamplot. I know a package python-ternary can draw ternary diagrams, but it can't draw stream plot. Can anyone help me?
scottshambaugh commentedon Dec 22, 2024
Some updates to the 2D implementation: #29333