How to set specific size of a figure with exportgraphics?
113 次查看(过去 30 天)
显示 更早的评论
Dear all,
I would like to save a figure with specific size with
function.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1026030/image.png)
I saw answers with
but I would like to use the
environment.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1026035/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1026040/image.png)
For example I would like to save with the following size:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1026045/image.png)
How can I do it?
X = 0:10:10;
Y = X;
Title = "hello.png";
F = figure;
plot(X,Y)
exportgraphics(F,Title,'Resolution',600)
Thanks in advance,
Best regards,
louis
0 个评论
采纳的回答
Richard Quist
2022-6-9
@Louis Tomczyk: exportgraphics does not provide an option for specifying an output size. That feature has been requested and is being considered, but I don't have any timeline for when/if that will be implemented.
You may find using the print command as an alternative, where the output size can be controlled by setting the figure's PaperPosition property (see the Printing & Exporting section of the figure properties documentation)
I hope that helps.
更多回答(1 个)
James Tursa
2022-6-9
This doesn't answer your question about controlling exported sizes, but you might be interested in the following export_fig FEX submission maintained by Yair Altman:
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Printing and Saving 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!