# Is Pyplot backend able to draw vectors in 3D?

**URL:** <https://discourse.julialang.org/t/is-pyplot-backend-able-to-draw-vectors-in-3d/85389>\
**Category:** General Usage\
**Tags:** plotting, pyplot, plots\
**Created:** [August 6, 2022, 10:26am UTC](https://discourse.julialang.org/t/is-pyplot-backend-able-to-draw-vectors-in-3d/85389 "2022-08-06T10:26:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Freya\_the\_Goddess](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/freya_the_goddess/32/36835_2.png) [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Post date:** [August 6, 2022, 10:26am UTC](https://discourse.julialang.org/t/is-pyplot-backend-able-to-draw-vectors-in-3d/85389/1 "2022-08-06T10:26:33Z")

</div>

I am open to any backend besides PyPlot.

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

```julia
using Plots
pyplot()

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

plot(xc,yc,zc,st=:line,arrows=:true,camera=(-30,30))

```

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](https://global.discourse-cdn.com/julialang/original/3X/c/3/c39fd8698ca64c9a914e08322a6779768bd112de.png)

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [August 6, 2022, 10:10pm UTC](https://discourse.julialang.org/t/is-pyplot-backend-able-to-draw-vectors-in-3d/85389/2 "2022-08-06T22:10:05Z")

</div>

For headless arrows, here is a simple way:

```julia
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)...)

```

---

<div class="post-metadata">

**Author:** ![Freya\_the\_Goddess](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/freya_the_goddess/32/36835_2.png) [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Post date:** [August 7, 2022, 10:04am UTC](https://discourse.julialang.org/t/is-pyplot-backend-able-to-draw-vectors-in-3d/85389/3 "2022-08-07T10:04:27Z")

</div>

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