Is there any way to selectively remove lines from a plot?

23 views (last 30 days)
Hi, I have an axes, I plot 100 lines on it then load some more data and plot another 100 lines. Is there a way of removing only the last 100 lines from the plot? Thanks in advance :)

Accepted Answer

Titus Edelhofer
Titus Edelhofer on 23 Jul 2012
Hi,
the easiest way is to store the handles you plot, e.g.
hPlot = zeros(100, 1);
for i=1:100
hPlot(i) = plot(someDataX, someDataY);
end
When you are unhappy with the (additional) data you plotted:
delete(hPlot);
removes them again and you can try again ...
Titus

More Answers (0)

Categories

Find more on Visual Exploration in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!