Changing legend of plot after calling plot using Plots.jl

I would like to do something like the following:

x = 1:10 
y = 2.*x
for p = 1:3
    plot(x,y, lab = "Data")
    p == 1 ? legend(:topright) : legend(false)

Except for the life of me I can’t find out how to change the legend after having plotted - it seems you can only do plot(x, y, legend=false) but not the above. Is that the case?

I believe you need to re-plot

I think plot!(legend = false) should do what you are looking for? plot! modifies the current plot instead of creating a new one.

Thank you, that’s exactly what I was looking for!