How to save subplots as tiff and fig?

1 回表示 (過去 30 日間)
Hana
Hana 2015 年 2 月 10 日
コメント済み: Walter Roberson 2024 年 11 月 27 日
subplot(2,2,1);
plot(x1,y1,'.g');
ylim([-10 20])
xlim([-10 10])
subplot(2,2,2);
plot(x2,y2,'.b');
ylim([-10 20])
xlim([-10 10])
subplot(2,2,);
plot(x3,y3,'.b');
ylim([-10 20])
xlim([-10 10])

回答 (2 件)

Image Analyst
Image Analyst 2015 年 2 月 10 日

Gautam
Gautam 2024 年 11 月 27 日
Hello Hana
To save subplots as both TIFF and FIG files in MATLAB, you can use the saveas function. To save the file in the desired format mention the file extension example:
saveas(gcf,'img.tif);
If no extension is specified, then the function saves the figure to a FIG-file.
Below is the workflow to save subplots in .tiff and .fig formats
for i=1:3
x = randi(10, [1 10]);
y = randi(10, [1 10]);
subplot(3,1,i)
plot(x,y)
filenameTif = sprintf('img%d.tif', i);
filenameFig = sprintf('img%d', i);
saveas(gcf, filenameTif);
saveas(gcf, filenameFig);
end
  1 件のコメント
Walter Roberson
Walter Roberson 2024 年 11 月 27 日
saveas() can only save entire figures, not subplots by themselves.

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

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by