Saving MATLAB Figures as PDFs: Issues & Solutions

  • Context: MATLAB 
  • Thread starter Thread starter NoobixCube
  • Start date Start date
  • Tags Tags
    Issues Matlab
Click For Summary
SUMMARY

This discussion addresses the issue of saving MATLAB figures as PDFs, specifically the problem of figures being cut off when saved in portrait orientation despite being landscape images. Users are advised against using MATLAB's default "save as PDF" function due to its limitations. Instead, a solution is provided involving the creation of a startup script that sets the default figure paper type to A4 and adjusts the figure dimensions accordingly. This method ensures that figures are properly scaled and allows for better formatting when saving as EPS and converting to PDF.

PREREQUISITES
  • Familiarity with MATLAB scripting
  • Understanding of figure properties in MATLAB
  • Knowledge of EPS and PDF file formats
  • Basic experience with MATLAB's graphical user interface
NEXT STEPS
  • Learn how to create and modify MATLAB scripts
  • Explore MATLAB figure properties and customization options
  • Research the EPS file format and its advantages for figures
  • Investigate methods for converting EPS files to PDF efficiently
USEFUL FOR

Researchers, engineers, and data analysts who utilize MATLAB for data visualization and need to produce high-quality figures for reports or publications.

NoobixCube
Messages
154
Reaction score
0
Hey all,
after producing a fig. with matlab, I save it as a PDF. But upon opening the pdf it seems to cut the fig to a portrait page, when the figure is actually a landscape image. Any ideas?
For an idea of what's going on, see the attached file.
 

Attachments

Physics news on Phys.org
Yeah don't ever use matlab's save as "pdf", it's terrible.
Two things if you are still going to do it this way:
-When you save as .pdf, the image will be produced according to the window size of your figure
-Look at your graph's, notice how they're rugged and "jaggedy"? That's a flaw of matlab.

I know you're attaching these figures in a document so here's something you should definitely do:
Go into matlab.
Create a new script file.
Place the following commands in it:

format long
format compact
set(0, 'defaultFigurePaperType', 'A4')
set(0, 'defaultFigurePaperUnits', 'centimeters')
set(0, 'defaultFigurePaperPositionMode', 'auto')

Save the file as startup.m and save in directory:
...\Matlab\Toolbox\Local\
Now everytime Matlab starts and you produce a figure, it will scale the window and any saved file to an A4 standard where you can fit upto 2 figures on a page. (save as EPS always, and convert to pdf).
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 7 ·
Replies
7
Views
15K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 12 ·
Replies
12
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
2
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 7 ·
Replies
7
Views
4K