How to export figures as pdf without truncated borders.

조회 수: 156 (최근 30일)
Frieder Wittmann
Frieder Wittmann 2019년 9월 27일
댓글: Frieder Wittmann 2020년 9월 7일
Update:
There is a solution now since 2019a and Save As will soon behave the same.
After filing a bug report (thanks Alex!) I got the following helpful eMail:
-----------------
Hello Frieder,
I am writing in reference to your Technical Support Case #03813750 regarding 'msaximizing plot in MS Windows and saving as pdf truncates'.
Starting with 19a you can use the axes toolbar for PDF export without cropping.
unnamed.png
I logged an enhancement to make SaveAs behave the same.
Further when using SaveAs you should also get a warning in MATLAB in the case things will get cut off including stating how to workaround:
Warning: The figure is too large for the page and will be cut off. Resize the figure, adjust the
output size by setting the figure's PaperPosition property, use the 'print' command with either the
'-bestfit' or '-fillpage' options, or use the 'Best fit' or 'Fill page' options on the 'Print
Preview' window.
----------------------
orginal post:
I plot a figure, enlarge it, select File -> Save As and choose pdf as output format and the resulting PDF it is truncated left and right.
I've been using MATLAB for 10 years and this has been a constant annoyance.
Yes, I can use export_fig etc. but such a basic default future being buggy all those years is just frustrating.
In my opinion this needs to be put to the top of Mathworks priority list.

답변 (2개)

Alex Pedcenko
Alex Pedcenko 2019년 9월 27일
This seems to happen when you are saving "maximized plot" window to PDF. MATLAB tries to fit figure into portrait page layout (when your figure in maximized window is more like "landscape"-like.
If you want to avoid "trim", make figure window smaller (e.g. "unmaximize" it), then PDF export does not seem to trim it (at least for me, R2017a).
Alex

Luis
Luis 2020년 9월 7일
The following worked for me:
set(gcf,'PaperType','A4')
  댓글 수: 3
Luis
Luis 2020년 9월 7일
I fully agree. It is even getting worse as new releases appear.
I just felt that a specific command would be nice for the people to use while the bug gets eventually solved.
Frieder Wittmann
Frieder Wittmann 2020년 9월 7일
Yes. Thank you!

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

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by