How to extract one plot from multiple plots?

조회 수: 7 (최근 30일)
Romio
Romio 2020년 7월 7일
댓글: Tony 2023년 7월 13일
If I have subplot of 8 plots, How can I plot, say, the second plot on a seperate figure?
  댓글 수: 1
Tony
Tony 2023년 7월 13일
Did you find a way of it?
I am also looking for a way to do it.

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

답변 (1개)

Tommy
Tommy 2020년 7월 8일
Assuming you have the figure handle, how about something like this?
% setup
f = figure;
for idx = 1:8
ax = subplot(4,2,idx);
plot(ax, rand(5));
end
clear idx ax
% copy, using only f
N = 2; % number of subplot to copy
f2 = figure;
referenceAx = axes(f2, 'Visible', 'off'); % to steal the Position from
newAx = copyobj(f.Children(end+1-N), f2);
newAx.Position = referenceAx.Position;
delete(referenceAx)
Maybe creating the invisible temporary axes is unnecessary, just seemed like an easy way to get the default size. Of course you don't have to reposition the axes at all if you don't want. Or an alternative would be to copy each child of axes #2 to the new set of axes.

카테고리

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

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by