-
-
Notifications
You must be signed in to change notification settings - Fork 317
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
How to access arrow positions/directions of streamplot object? #4666
Comments
without understanding how these plot objects work it seems difficult to access the streamplot arrow positions/directions, but somebody out there knows how to answer this with a quick solution. |
The positions and directions are rather internal to plot. If you want to modify them you'll have to fight quite a bit. The arrows are drawn by Makie.jl/src/basic_recipes/streamplot.jl Line 168 in 2e0aabe
You can get the rotation from p.rotation . In 3D they are Vec3f s that set the direction of the mesh, updated by the same inputs as positions. In 2D they are rotation angles which update on scene.camera.projectionview and scene.viewport on top of the above, i.e. also when you change the view in any way.In the end, you could do something like this sp = streamplot!(...)
onany(sp.f, sp.limits, sp.gridsize, sp.stepsize, sp.maxsteps, sp.density, sp.color, a.scene.camera.projectionview, a.scene.viewport) do _1, _2, _3, _4, _5, _6, _7, _8, _9
pos = sp.plots[2].args[1][]
rot = sp.plots[2].rotation[]
...
sp.plots[2].args[1][] = new_pos
sp.plots[2].rotation[] = new_rot
end to overwrite whatever a (2D) streamplot does whenever it updates. |
Excellent, thank you. Also, not sure what you mean by "changing the view in any way" as I did not need the "onany ... do" thingy when I move the 3D plot view with the mouse. |
Yea the view thing only applies if the plot limits are 2D (or equivalently if |
How can the arrow positions and directions be accessed of a
streamplot
plot object?Specifically, I'd like to update the directions of the arrows and also need the positions of the arrows too.
The text was updated successfully, but these errors were encountered: