Label vectors in Plots

Hi all,

Is it possible to label vectors in a plot rather than in the legend? Here is an example where I would like to label the vectors A and B.

using Plots
plot(
    sqrt.([0,.5]),
    sqrt.([0,.5]), 
    xlims = (-1.0, 1.0), 
    ylims=(-1.0,1.0), 
    arrow = true, 
    color = :black, 
    linewidth = 2, 
    label = "",
    framestyle = :origin,
)

using Plots
plot!(
    sqrt.([.5,.5]),
    sqrt.([.5,.0]), 
    arrow = true, 
    color = :black,
    linestyle=:dash, 
    linewidth = 2, 
    label = "",
    framestyle = :origin,
)

You can annotate:

annotate!(0.3, 0.5, text("A", :red, 12))
annotate!(0.8, 0.3, text("B", :blue, 12))
1 Like

@rafael.guerra, thank you for answering so many of my questions!

1 Like