Is there a streamlines function/package?

Does anyone know of a package to compute 3D streamlines in Julia?
Like Matlab’s: Compute 3-D streamline data - MATLAB stream3 - MathWorks Deutschland
I specifically want to get the XYZ data describing the streamlines.

If not a package in Python that I can retrieve these with PyCall would also work.

Tim

1 Like

Mackie.jl streamplot 3d example

A search shows this discussion on Makie
https://github.com/JuliaPlots/Makie.jl/issues/355
Simon Danisch I am sure will be along here soon!

OK great, I updated to the latest version of Makie (Julia 1.1.1) and using either
http://juliaplots.org/MakieReferenceImages/gallery//streamplot_1/index.html or
http://juliaplots.org/MakieReferenceImages/gallery//streamplot_3d/index.html from
Home I get the following error:

streamplot(f, -1.5..1.5, -1.5..1.5, -1.5..1.5, colormap = :magma, gridsize = (10, 10), arrow_size = 0.06)
ERROR: UndefVarError: streamplot not defined
streamplot(f, -1.5..1.5, -1.5..1.5, colormap = :magma)
ERROR: UndefVarError: streamplot not defined

Any suggestions? I am also interested to find a way to easily return X Y and Z of the lines.

Did you also run using Mackie?

Running the full example code works for me (you do have to include using Makie, though).

As for getting the lines back, you could dig through the sub-plots of the streamplot. For example (and I haven’t tried this),

sp = streamplot(...)[end]

sp.plots[1][1] # should be a Vector{Point}

If you only need the streamlines you can call the implementation directly:

arrow_pos, arrow_dir, line_points = AbstractPlotting.streamplot_impl(Point2f0, x->Point2f0(-0.1*x[2], 0.1*x[1]), Rect(0,0,1,1), (100,100), 0.1 )

or in 3d

arrow_pos, arrow_dir, line_points = AbstractPlotting.streamplot_impl(Point3f0, x->Point3f0(-0.1*x[2], 0.1*x[1], -0.1x[3]), Rect(0,0,0,1,1,1), (100,100,100), 0.1 )

2 Likes

Great, I now have it plotting. mschauer do you have an code snippet in 3D where you extract the line data?
Would I use “Point3f0” and “Cube”?

Cheers,
Tim

I edited my post.

Great, thanks!