필터 지우기
필터 지우기

Make lines visible or invisible

조회 수: 151 (최근 30일)
Elena
Elena 2016년 10월 20일
댓글: camicat 2020년 2월 5일
Is there a way (in a script) to make lines visible or invisible when you open a figure already existing (using openfig())? Thanks

답변 (2개)

KSSV
KSSV 2016년 10월 20일
plot(rand(10,1))
set(gcf,'visible','off')
set(gcf,'visible','on')

Mischa Kim
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
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
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 CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by