figureのpos​ition領域(プロ​ット範囲)のみの保存​方法

上記ページで青枠で囲まれたプロット範囲(position領域)のみを.figまたはjpgで保存したいのですが、方法を教えていただきたく思います。

1 Comment

michio
michio on 18 Jul 2018
URLをハイパーリンク化しました。

Sign in to comment.

 Accepted Answer

michio
michio on 18 Jul 2018
「余白を最小限にした Figure の保存」 の最後のサンプルコード部分が参考になるかと思います。
この時に、
axes = gca;
axes.Position = [0,0,1,1];
上記コマンドで axes オブジェクトの Position プロパティを Figure 全体を占めるようにしておけば、ご所望のファイル出力になるかと思います。ご確認いただけますでしょうか。
fig = gcf;
plot(rand(10,2))
axes = gca;
axes.Position = [0,0,1,1];
fig.PaperPositionMode = 'auto'
fig_pos = fig.PaperPosition;
fig.PaperSize = [fig_pos(3) fig_pos(4)];
% ファイル形式での Figure の保存
% Figure をファイルに保存します。
print(fig,'MySavedFile','-djpeg')

1 Comment

NAKAI TAKUYA
NAKAI TAKUYA on 18 Jul 2018
ありがとうございます。解決しました!

Sign in to comment.

More Answers (0)

Categories

Asked:

on 18 Jul 2018

Commented:

on 18 Jul 2018

Community Treasure Hunt

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

Start Hunting!