# How to add LaTeX Annotations for 3-d Plots (Backend GR and Pyplot)

**URL:** <https://discourse.julialang.org/t/how-to-add-latex-annotations-for-3-d-plots-backend-gr-and-pyplot/85473>\
**Category:** General Usage\
**Tags:** latex, plots\
**Created:** [August 8, 2022, 1:16pm UTC](https://discourse.julialang.org/t/how-to-add-latex-annotations-for-3-d-plots-backend-gr-and-pyplot/85473 "2022-08-08T13:16:02Z")\
**Posts on this page:** 5\
**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 8, 2022, 1:16pm UTC](https://discourse.julialang.org/t/how-to-add-latex-annotations-for-3-d-plots-backend-gr-and-pyplot/85473/1 "2022-08-08T13:16:02Z")

</div>

Hi all,

I create this 3-d plot for vectors in 3-d, tried `annotate!()` and it does not work.  
Is it possible to add annotate? If possible, I want to add latex symbol like subscript.

```julia
# Plot norm of a vector in 3-d
using Plots, LaTeXStrings
gr()

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

P, xc, yc, xyc, dc = [0,0,0], [0,1,0], [1,0,0], [1,1,0], [1,1,1]

plot(extract(P,xc)..., st=:line, linecolor=:blue, linestyle=:dash, camera=(73,30))
plot!(extract(P,yc)..., st=:line, linecolor=:purple, linestyle=:dash, arrow=true)
plot!(extract(P,xyc)..., st=:line, linecolor=:green, linestyle=:dash)
plot!(extract(P,dc)..., st=:line, linecolor=:green)
plot!(extract(xyc,xc)..., st=:line, linecolor=:blue, linestyle=:dot)
plot!(extract(xyc,yc)..., st=:line, linecolor=:purple, linestyle=:dot)
plot!(extract(xyc,dc)..., st=:line, linecolor=:green, linestyle=:dot)

scatter!([1], [1], [1], color = "green", label="", markersize = 3)

```

![Capture d’écran_2022-08-08_20-10-42](https://global.discourse-cdn.com/julialang/original/3X/3/8/387cc75db5de7dc9b6e330648c82676b142e3dd5.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 8, 2022, 1:48pm UTC](https://discourse.julialang.org/t/how-to-add-latex-annotations-for-3-d-plots-backend-gr-and-pyplot/85473/2 "2022-08-08T13:48:44Z")

</div>

The lack of 3D plot annotations seems to be a long lasting limitation of Plots.jl, see an [open issue here](https://github.com/JuliaPlots/Plots.jl/issues/362).

---

<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 8, 2022, 2:30pm UTC](https://discourse.julialang.org/t/how-to-add-latex-annotations-for-3-d-plots-backend-gr-and-pyplot/85473/3 "2022-08-08T14:30:22Z")

</div>

It’s okay, I just add this at `plot!()` → `label="v", `

---

<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 8, 2022, 5:06pm UTC](https://discourse.julialang.org/t/how-to-add-latex-annotations-for-3-d-plots-backend-gr-and-pyplot/85473/4 "2022-08-08T17:06:57Z")

</div>

The following workaround seems to allow the text to be displayed on a 2D canvas over the 3D plot. But we have to manually adjust the coordinates until we are satisfied:

```julia
plot!([0.77], [0.75], text=L"\pi/2")

```

 ![Plots_gr_plot_Latex_text_on_3D_plots](https://global.discourse-cdn.com/julialang/original/3X/c/b/cbb21c161c23060bb01e411c10d6fd9ecb365151.png)

---

<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 10, 2022, 9:20am UTC](https://discourse.julialang.org/t/how-to-add-latex-annotations-for-3-d-plots-backend-gr-and-pyplot/85473/5 "2022-08-10T09:20:35Z")

</div>

It is a nice workaround, so we can use text too, thanks.
