グラフの一部の拡大図のみ保存したい
Show older comments
グラフの一部の拡大図をaxesのオプションで作成しました。拡大図のみを保存したいので、元のグラフを非表示にしたのですが、この状態で保存すると、拡大図の後ろに白い部分が存在してしまいます(添付画像)。作成した正方形の拡大図の部分のみを保存することは、可能でしょうか。

以下使用したコードです。
x = (1:2:9);
y = (1:2:9);
f = figure;
%ax1 = axes('Position',[0.1 0.1 0.7 0.7]);
ax2 = axes('Position',[0.2 0.2 0.4 0.4]);
%plot(ax1,x,y,'.r')
plot(ax2,x,y,'.r')
pbaspect([1 1 1])
%axis(ax1,[0 10 0 10])
axis(ax2,[0 4 0 4])
ax = gca;
ax.XTickLabel = [];
ay = gca;
ay.YTickLabel = [];
set(gca,'TickLength',[0 0])
rootname = 'image'; % 画像ファイル名
saveas(gca,['E:\image_edit\',rootname,'.png']);
Accepted Answer
More Answers (0)
Categories
Find more on グラフィックス パフォーマンス in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

