Remove data in figure after plot

I have the following situation, and I would like to select only some of that curves. Is there a manner?

3 comentarios

This methods assume you know the order of lines plotted and you know which lines (by number) you want to delete -
x = 0:0.01:10;
%5 curves
y1 = 10*sin(x);
y2 = 10*cos(x);
y3 = 0*x+10;
y4 = x.^2;
y5 = 10*(sin(x)-cos(x));
%plotting the curves
figure
plot(x,y1,x,y2,x,y3,x,y4,x,y5)
%Find line objects
h = findobj('type','line');
%The list returns the lines in the reverse order
%So (i)th line drawn corresponds to the (n(total number of lines)- i + 1) th
%element of h
delete(h(6-[2 5]))
Gabriele Curcio
Gabriele Curcio el 8 de Jun. de 2023
But I can make the curves invisible inside the "Figure" window?
Dyuman Joshi
Dyuman Joshi el 9 de Jun. de 2023
What exactly do you mean by that?

Iniciar sesión para comentar.

 Respuesta aceptada

the cyclist
the cyclist el 8 de Jun. de 2023
Similar to @Dyuman Joshi's answer, you can make the line "invisible", rather than deleting:
x = 0:0.01:10;
%5 curves
y1 = 10*sin(x);
y2 = 10*cos(x);
y3 = 0*x+10;
y4 = x.^2;
y5 = 10*(sin(x)-cos(x));
%plotting the curves
figure
h = plot(x,y1,x,y2,x,y3,x,y4,x,y5);
% Turn off the visibility of the first curve
set(h(1),"Visible","off")

2 comentarios

Gabriele Curcio
Gabriele Curcio el 8 de Jun. de 2023
But I can make the curves invisible inside the "Figure" window?
the cyclist
the cyclist el 8 de Jun. de 2023
Editada: the cyclist el 8 de Jun. de 2023
I'm confused. Here, I'm making all the curves invisible.
x = 0:0.01:10;
%5 curves
y1 = 10*sin(x);
y2 = 10*cos(x);
y3 = 0*x+10;
y4 = x.^2;
y5 = 10*(sin(x)-cos(x));
%plotting the curves
figure
h = plot(x,y1,x,y2,x,y3,x,y4,x,y5);
% Turn off the visibility of all curves
set(h,"Visible","off")

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Centro de ayuda y File Exchange.

Productos

Versión

R2021a

Etiquetas

Preguntada:

el 8 de Jun. de 2023

Comentada:

el 9 de Jun. de 2023

Community Treasure Hunt

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

Start Hunting!

Translated by