Plot 3d vector field

plotting

#1

I would like to plot a 3d vector field (e.g. a couple of points with arrows attached), with some basic interactivity (rotatate, zoom, pan). What are my options to do this in julia? Are there some example codes with 3d vector fields? Is it possible with Plots.jl?


How to draw arrows in 3D with Plots.jl?
#2

Matplotlib (and hence PyPlot) can do this.


#3

Thanks it works! Here is an example for those who may have the same question:

using PyPlot

pygui(true)

fig = figure()
ax = fig[:gca](projection="3d")

N = 10
x,y,z,u,v,w = [randn(N) for _ in 1:6]
ax[:quiver](x,y,z, u,v,w)


#4

Hello.

I have a small problem with quiver in 3d. When setting the axes scale I am unable to set the z axis. x and y axes work well but somehow the 3d projection does not work with z.

Here is the same example as before

using PyPlot

pygui(true)

fig = figure()
ax = fig:gca

N = 10
x,y,z,u,v,w = [randn(N) for i in 1:6]
ax[:quiver](x,y,z, u,v,w)
axis([-5, 5, -5, 5])

This seems to work, however:

using PyPlot

pygui(true)

fig = figure()
ax = fig:gca

N = 10
x,y,z,u,v,w = [randn(N) for i in 1:6]
ax[:quiver](x,y,z, u,v,w)
axis([-5, 5, -5, 5, -5, 5])

This throws the following error:
ValueError(u’v must contain [xmin xmax ymin ymax]’,) so only x and y axes are defined

Can anybody help?


#5

Please quote code blocks with backticks (and without code errors).

using PyPlot

pygui(true)

fig = figure()
ax = fig[:gca](projection="3d")

N = 10
x,y,z,u,v,w = [randn(N) for _ in 1:6]
ax[:quiver](x,y,z, u,v,w)
xlim([0.0, 1.0])
ylim([0.0, 1.0])
zlim([0.0, 1.0])

works for me.


#6

Thanks crstnbr
It works.
And sorry I will keep that in mind from now on.