How to set specific size of a figure with exportgraphics?

조회 수: 136 (최근 30일)
Louis Tomczyk
Louis Tomczyk 2022년 6월 9일
댓글: Louis Tomczyk 2022년 6월 10일
Dear all,
I would like to save a figure with specific size with function.
I saw answers with but I would like to use the environment.
For example I would like to save with the following size:
(sorry guys, but it might be a good idea to stop using non SI units like inches of whatever ^_^)
How can I do it?
X = 0:10:10;
Y = X;
Title = "hello.png";
F = figure;
Thanks in advance,
Best regards,

채택된 답변

Richard Quist
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
Louis Tomczyk
Louis Tomczyk 2022년 6월 10일
Thanks for the clear and direct response.
Even with I can hardly fix both size in and resolution.
So finally I will still use only the resolution or "-depsc" format.
Thanks again
best, louis

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

James Tursa
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:
  댓글 수: 1
Louis Tomczyk
Louis Tomczyk 2022년 6월 10일
Yes i saw this, many people mention it.
But I don't know if I want to spend more time on such low importance detail.
Native functions work already quite well.
Thanks for the suggestion,
Best, louis

댓글을 달려면 로그인하십시오.


Help CenterFile Exchange에서 Printing and Saving에 대해 자세히 알아보기




Community Treasure Hunt

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

Start Hunting!

Translated by