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

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.

# 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

The lack of 3D plot annotations seems to be a long lasting limitation of Plots.jl, see an open issue here.

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

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:

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

1 Like

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