Make lines visible or invisible
135 次查看(过去 30 天)
显示 更早的评论
Is there a way (in a script) to make lines visible or invisible when you open a figure already existing (using openfig())? Thanks
0 个评论
回答(2 个)
Mischa Kim
2016-10-20
编辑:Mischa Kim
2016-10-20
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 个评论
Devlin Murray
2019-9-30
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
2020-2-5
@Devlin Murray were you able to figure out how to do what you asked? I'm trying to do the same thing, thank you!
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!