How to export figures as pdf without truncated borders.

151 ビュー (過去 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 件のコメント
Stephen23
Stephen23 2019 年 9 月 27 日
Frieder Wittmann
Frieder Wittmann 2019 年 10 月 3 日
Thanks. Done.

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

回答 (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
  1 件のコメント
Frieder Wittmann
Frieder Wittmann 2019 年 10 月 3 日
True. But its still an annoying bug.

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


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 Center および File ExchangeAnnotations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by