saving an subplotted image
古いコメントを表示
I have an image
subplot(1,2,1) subplot(1,2,2)
two images in one figure window,now i want to write this image,i posted this question ,but could not get relevant answer ,please help
回答 (3 件)
Iñigo Moreno
2020 年 9 月 28 日
With the newer versions of matlab, if you just want to save one of the subplots to a file:
h=subplot(2,1,1);
plot(1:10);
myAxes=findobj(h,'Type','Axes');
exportgraphics(myAxes,'myFile.pdf');
Grzegorz Knor
2011 年 12 月 8 日
0 投票
Daniel Shub
2011 年 12 月 8 日
You can use export_fig from the FEX http://www.mathworks.com/matlabcentral/fileexchange/23629-exportfig
or do something like
figure;
subplot(2,2,1);
plot(1:10);
hax = subplot(2,2,2);
plot(1:5);
Make a new figure, copy the axis to it, scale the axis to be the "full" size, and print it.
hfig = figure;
hax_new = copyobj(hax, hfig);
set(hax_new, 'Position', get(0, 'DefaultAxesPosition'));
print(hfig);
If you want a jpg, od:
print(gcf, '-djpeg', 'myfigure')
5 件のコメント
Image Analyst
2011 年 12 月 8 日
Yes, in fact "saving figures" questions are asked once or twice a day. Probably the most frequently asked question there is.
Pat
2011 年 12 月 8 日
Sean de Wolski
2011 年 12 月 8 日
Pat, please read the documentation Grzegorz and I have both pointed you to for print(). It will tell you how to print to a jpg.
Daniel Shub
2011 年 12 月 8 日
If you want a jpg (you should edit your question to include this information) just add the jpg flag ... (see my edited answer).
Pat
2011 年 12 月 9 日
カテゴリ
ヘルプ センター および File Exchange で Image Preview and Device Configuration についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!