Adding Error Bars To Legend


I’m trying to make a plot (with Plots) with some data points. I’d like to be able to add an entry to the legend labeling the error bars.

So far I have something of the sort:

    yerr = rand(10) ./ 10,
    label = "Data Points"

Is there any way of having an extra row in my legend with something like a cross next to another labeling for the error bars?


One way with no bells and whistles:

using Plots; gr()
p = scatter(rand(10), yerr = rand(10)/10, label="Data Points", c=:blues)
scatter!([-1],[NaN], xlims=xlims(p), ylims=(-0.5,2), label=" ")
scatter!([-1],[-1], xlims=xlims(p), shape=:cross, label="Error bars", c=:black)

1 Like

Alright thanks! I’ll be using that!