How to add a secondary axis to a .fig ?

3 ビュー (過去 30 日間)
Marguerite Marnat
Marguerite Marnat 2021 年 11 月 2 日
回答済み: Johannes Hougaard 2021 年 11 月 3 日
I know that a secondary axis can be added using e.g. yyaxis and that its properties can then also be edited in the property editor of the figure. However I could not find how to add a secondary axis to a saved .fig, how would one do that ?

採用された回答

Johannes Hougaard
Johannes Hougaard 2021 年 11 月 3 日
Use the function 'open' to load the saved figure to a variable (a handle) and use yyaxis to add the secondary axis
figure;
axes;
x = linspace(-4*pi,4*pi,200);
plot(x,sin(x))
savefig(gcf,'newfigure.fig');
nf = open('newfigure.fig');
yyaxis(nf.CurrentAxes,'right');
plot(x,cos(x./3))

その他の回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by