Effacer les filtres
Effacer les filtres

How to clear only a part of the plot

131 vues (au cours des 30 derniers jours)
Sonima
Sonima le 26 Juil 2018
Modifié(e) : Stephen23 le 26 Juil 2018
Hi! I have a figure with multi lines plotted in different steps. plot(a); hold on; plot(b); plot(c); plot(d);
I want to clear only the some of the plots and hold the rest.
delete plot(a) and plot(c)
cfl will remove all. Any solution to this? thanks.

Réponse acceptée

KSSV
KSSV le 26 Juil 2018
figure
hold on
h1 = plot(rand(10,1)) ;
h2 = plot(rand(10,1)) ;
h3 = plot(rand(10,1)) ;
h4 = plot(rand(10,1)) ;
set(h2,'Visible','off')
set(h4,'Visible','off')
  1 commentaire
Stephen23
Stephen23 le 26 Juil 2018
Modifié(e) : Stephen23 le 26 Juil 2018
This does not clear them from the plot, just makes the lines not visible.

Connectez-vous pour commenter.

Plus de réponses (1)

Stephen23
Stephen23 le 26 Juil 2018
Modifié(e) : Stephen23 le 26 Juil 2018
This will actually delete the line objects from the axes:
ah = plot(...);
hold on
bh = plot(...);
ch = plot(...);
delete(ah)
delete(ch)

Catégories

En savoir plus sur Graphics Object Properties dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by