Print PDF from Matlab

Saving PDF of plots from Matlab is an effective way to use Matlab plots in LaTeX or for general sharing of high quality plots. Matlab exportgraphics, solved many of the previously long-standing issues with getting production-ready plots from Matlab. We also recommend tiledlayout for creating subplots. The Mathworks is continuing to upgrade Matlab’s plotting capabilities, so keep an eye on the release notes for new releases, it may finally fix issues you’ve had in the past.


fg = figure;
ax = axes('parent', fg);
plot(ax, 1:10)

exportgraphics(fg, 'line.pdf', 'Resolution', 300)


Matlab R2020a Update 5 fixed bugs with exportgraphics.


The “print” and “saveas” functions are generally not recommended for saving plots from Matlab as they suffer from matching the saved file to what is seen on the screen. Use “exportgraphics” instead.

  • print() allows controlling image DPI via the -rDPI option, while saveas() is fixed at 150 DPI
  • saveas() is an “easier” version of print(), since saveas() is actually making calls to print() for both Matlab and Octave.