Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[ENH]: A function for computing and displaying 3D streamline? #26539

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
xli2522 opened this issue Aug 16, 2023 · 7 comments
Open

[ENH]: A function for computing and displaying 3D streamline? #26539

xli2522 opened this issue Aug 16, 2023 · 7 comments

Comments

@xli2522
Copy link

xli2522 commented Aug 16, 2023

Problem

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.

Similar functions in Mayavi , Magpylib via Pyvista, and Mathematica.

Proposed solution

No response

@scottshambaugh
Copy link
Contributor

scottshambaugh commented 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
Copy link
Member

jklymak commented 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
Copy link
Contributor

@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
Copy link
Member

jklymak commented 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
Copy link

Seconding this - I would love a 3D streamplot feature for Matplotlib. Is there any work being done in this direction?

@Gritbadger
Copy link

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
Copy link
Contributor

Some updates to the 2D implementation: #29333

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants