フィルターのクリア

How can the set Figure properties for the whole script?

5 ビュー (過去 30 日間)
Friedrich Maack
Friedrich Maack 2017 年 9 月 20 日
Hi,
I would like to have all my plots in the script to have the same appearance and to be saved as pdf with minimal whitespace, so I can insert them in a Latex document. I took the commands from https://de.mathworks.com/help/matlab/creating_plots/save-figure-with-minimal-white-space.html :
ax = gca;
outerpos = ax.OuterPosition;
ti = ax.TightInset;
left = outerpos(1) + ti(1);
bottom = outerpos(2) + ti(2);
ax_width = outerpos(3) - ti(1) - ti(3);
ax_height = outerpos(4) - ti(2) - ti(4);
ax.Position = [left bottom ax_width ax_height];
fig = gcf;
fig.PaperPositionMode = 'auto';
fig_pos = fig.PaperPosition;
fig.PaperSize = [fig_pos(3) fig_pos(4)];
They do exactly what I want but the settings always apply to gca and gcf so I would have to copy/paste these commands below every plot. I would like to know how to save them as default. For example it works with
set(0,'defaulttextinterpreter','latex');
and other similar commands.
Thank you!

採用された回答

Tim Berk
Tim Berk 2017 年 9 月 20 日
You can set almost all Figure values as default. For example:
set(0,'DefaultFigurePaperPositionMode','auto')
Or
set(0,'DefaultAxesPosition',[0 0 1 1])
  2 件のコメント
Friedrich Maack
Friedrich Maack 2017 年 9 月 20 日
I kind of answered myself in the meantime. The only solution I found was to create a function that contains all the settings and apply it to gcf below every figure. That way the properties are still set every time, but at least in a condensed form.
Thank you for your Answer!
Shoaib Ayjaz Mohammed
Shoaib Ayjaz Mohammed 2020 年 8 月 18 日
Hi Friedrich,
It woud be great if you could post an example for the function you created for the figure properties?
Thanks

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by