필터 지우기
필터 지우기

anyway to use tight_subplot function in 'invisible' figure

조회 수: 5 (최근 30일)
Yu Li
Yu Li 2019년 1월 14일
댓글: Yu Li 2019년 1월 16일
Hi:
is there anyway to use the tight_subplot function in 'invisible' figure?
https://www.mathworks.com/matlabcentral/fileexchange/27991-tight_subplot-nh-nw-gap-marg_h-marg_w
I create a invisible figure, but when use 'tight_subplot' function, is will create a new figure every time I run the code, below is the test code:
fig=figure('visible','off');
ha= tight_subplot(2,2,[0.11,0.08],0.08,0.08);
for i=1:1:4
axes(ha(i));
plot(1:5,1:5)
end
Thanks!
Yu

채택된 답변

Jauching Lu
Jauching Lu 2019년 1월 16일
The line:
> axes(ha(i));
makes the axes ha(i) be the current axes and brings the parent figure into focus (visible).
The workaround is to directly tell 'plot' function the target axes by passing 'ha(i)' to its first input.
> plot(ha(i),1:5,1:5)
fig=figure('visible','off');
ha= tight_subplot(2,2,[0.11,0.08],0.08,0.08);
for i=1:1:4
plot(ha(i),1:5,1:5)
end
  댓글 수: 1
Yu Li
Yu Li 2019년 1월 16일
Thank you very much, the problem has been solved.
Bests,
Yu

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by