Borrar filtros
Borrar filtros

Make lines visible or invisible

151 visualizaciones (últimos 30 días)
Elena
Elena el 20 de Oct. de 2016
Comentada: camicat el 5 de Feb. de 2020
Is there a way (in a script) to make lines visible or invisible when you open a figure already existing (using openfig())? Thanks

Respuestas (2)

KSSV
KSSV el 20 de Oct. de 2016
plot(rand(10,1))
set(gcf,'visible','off')
set(gcf,'visible','on')

Mischa Kim
Mischa Kim el 20 de Oct. de 2016
Editada: Mischa Kim el 20 de Oct. de 2016
There is:
t = 0:0.1:10;
y = sin(t);
figure
h1 = plot(t,y);
set(h1,'Tag','Line1')
hold on
h2 = plot(t,y.^2);
set(h2,'Tag','Line2')
savefig('MySavedPlot.fig');
close(gcf)
clear
fig = openfig('MySavedPlot.fig');
axesObjs = get(fig, 'Children');
dataObjs = get(axesObjs, 'Children');
set(findobj(dataObjs,'Tag','Line2'),'LineStyle','none');
  4 comentarios
Devlin Murray
Devlin Murray el 30 de Sept. de 2019
Is there a way to do this but still have the original color show up in the legend. I want to have a correct legend corresponding to conditions but if the plot doesn't meet all of them I don't want to plot it.
camicat
camicat el 5 de Feb. de 2020
@Devlin Murray were you able to figure out how to do what you asked? I'm trying to do the same thing, thank you!

Iniciar sesión para comentar.

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by