Updating a plot

How to update an already created plot?

Let’s say we have a plotting function returning a handle like this one:
h=plot(x, y, seriestype:scatter)
And, afterwards, we decided to change the scatter points to a solid line.
I tried to do the following:


But it gives following error:

Error showing value of type Plots.Plot{Plots.PyPlotBackend}:
ERROR: BoundsError: attempt to access 0-element Array{Any,1} at index [1]

Any hints?

First, it is better to give a complete and running example:

Also, you should indicate the plotting libraries and/or backend to help you.

1 Like

Working example:

using Plots
#plots backend doesn't matter. I can use any. Question is general how to do it. 
h=plot(rand(5), rand(5), seriestype=:scatter)

With PyPlot it produces mentioned above error. With GR it creates empty plot.
I suppose the reason is, there are some other parameters (e.g. line thickness) that I should change to update the curves. But maybe there is a simple solution?

You can’t really change an existing plot with Plots. Just plot it again. This is one of the things that Makie does better.