How to export figures as pdf without truncated borders.

212 visualizaciones (últimos 30 días)
Frieder Wittmann
Frieder Wittmann el 27 de Sept. de 2019
Comentada: Frieder Wittmann el 7 de Sept. de 2020
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.

Respuestas (2)

Alex Pedcenko
Alex Pedcenko el 27 de Sept. de 2019
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 el 7 de Sept. de 2020
The following worked for me:
set(gcf,'PaperType','A4')
  3 comentarios
Luis
Luis el 7 de Sept. de 2020
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.

Iniciar sesión para comentar.

Categorías

Más información sobre Introduction to Installation and Licensing en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by