Save a .fig from a subplot as subplots are building up?

1 回表示 (過去 30 日間)
David Pesetsky
David Pesetsky 2018 年 4 月 26 日
コメント済み: David Pesetsky 2018 年 4 月 26 日
Hello,
I am building up subplots in a loop like:
h2(nn-1)=subplot(6,4,nn-1);
mytitle=name;
plot(x,y0,'k.',x,y,'r-',x,yp,'b-');
where nn is looping. Before I go to the next nn, I'd like to save off a full size version of the subplot to a .fig. Everytime I try something, the saved off works, but somehow the subplot doesn't build up anymore (there is only the last lower corner plot existing on the subplot). Somehow the save-off interfers with the main subplots.
What's the right way to build subplots while also saving off copies?
Thanks.

採用された回答

Walter Roberson
Walter Roberson 2018 年 4 月 26 日
Before the loop do
fig = gcf;
Then change
h2(nn-1)=subplot(6,4,nn-1);
to
h2(nn-1)=subplot(6, 4, nn-1, 'Parent', fig);
  3 件のコメント
Walter Roberson
Walter Roberson 2018 年 4 月 26 日
I suggest you look at export_fig from the File Exchange. It can take an axes handle; it recreates the content of the axes in a figure and then saves the copy.
David Pesetsky
David Pesetsky 2018 年 4 月 26 日
No. Turned out all I needed to do is CLOSE the larger copy, and then further "plot" commands continue to get loaded to the sub-plot building up.
Thanks.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSubplots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by