Is Pyplot backend able to draw vectors in 3D?

I am open to any backend besides PyPlot.

But I am currently use Pyplot to plot vectors, but unable to, here are the codes:

using Plots

xc = [0,0,1]
yc = [0,1,0]
zc = [1,0,0]


I want to basically create vectors:

  1. vector (1,0,0) : a line that is connecting (0,0,0) and (1,0,0)
  2. vector (0,1,0) : a line that is connecting (0,0,0) and (0,1,0)
  3. vector (0,0,1) : a line that is connecting (0,0,0) and (0,0,1)

there should be 3 different lines / vectors.

But, instead of getting the vectors, I plot a line connecting x,y,z. Hopefully I can get help with this.

Capture d’écran_2022-08-06_17-19-12

For headless arrows, here is a simple way:

using Plots; pyplot()

extract(P,V) = [ [P[1], V[1]], [P[2], V[2]], [P[3], V[3]] ]

P, xc, yc, zc = [0,0,0], [0,0,1], [0,1,0], [1,0,0]

plot(extract(P, P+xc)..., camera=(-30,30))
plot!(extract(P, P+yc)...)
plot!(extract(P, P+zc)...)
1 Like

Thanks @rafael.guerra
I could change the backend to gr() too but without interactivity.