フィルターのクリア

Creating an inset figure from an other fig file

16 ビュー (過去 30 日間)
Wissem-Eddine KHATLA
Wissem-Eddine KHATLA 2024 年 3 月 12 日
コメント済み: Voss 2024 年 3 月 13 日
Hello everyone,
I am trying to create an inset in a figure based on a different figure.
Basically, I have a plot that generates a figure and then I add :
handaxes2 = axes('position', [0.52 0.52 0.38 0.38]);
To create my inset figure and then I plot my data. But I don't know how I can do it with an other .fig file instead of a set of data ?
I have attached my fig files if needed,
Thank you for your help,
Best regards.

採用された回答

Voss
Voss 2024 年 3 月 12 日
% open the first figure
fig1 = openfig('figure1.fig','visible');
% create the new axes
ax2 = axes(fig1,'Units','normalized','position',[0.52 0.52 0.38 0.38]);
% open the second figure
fig2 = openfig('figure2.fig','invisible');
% copy the stuff from the second figure's axes into the new axes
ch = findall(fig2.CurrentAxes);
ch(ch == fig2.CurrentAxes) = [];
copyobj(ch,ax2)
% delete the second figure
delete(fig2)
  2 件のコメント
Wissem-Eddine KHATLA
Wissem-Eddine KHATLA 2024 年 3 月 13 日
Thank you @Voss : your help was appreciated. Indeed, I was looking for this particular function to copy a whole figure dataset.
Voss
Voss 2024 年 3 月 13 日
You're welcome! Any other questions, please let me know.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePrinting and Saving についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by