I'd like to use PDF versions of my matlab plots in a LaTeX document. I'm saving the figures using the "saveas" command with the PDF option but I get huge white space around my plots in the pdf files. Is this normal? How can I get rid of it? Automatically, of course, since I have "a lot" of plots.
1 Correct answer You can use the Crop Pages tool (under Tools - Organize Pages) to manually or automatically remove white space from the pages in your file. You can use the Crop Pages tool (under Tools - Organize Pages) to manually or automatically remove white space from the pages in your file.
plot(..); smart_clean('NoWhiteSpace');
Accepted Answer To avoid showing figures in MATLAB you can start MATLAB using the noFigureWindows option. This option is not available on UNIX.
Use the File > Export Setup dialog. Use Edit > Copy Figure to copy the figure's content to the system clipboard. For details, see Customize Figure Before Saving and Copy Figure to Clipboard from Edit Menu.
Exporting Figures for Publication is a good starting point. Instead of -deps
use -dpdf
for pdf output.
You can fix the bounding box issue using the code below.
set(gcf, 'PaperSize', [6.25 7.5]); set(gcf, 'PaperPositionMode', 'manual'); set(gcf, 'PaperPosition', [0 0 6.25 7.5]); set(gcf, 'PaperUnits', 'inches'); set(gcf, 'PaperSize', [6.25 7.5]); set(gcf, 'PaperPositionMode', 'manual'); set(gcf, 'PaperPosition', [0 0 6.25 7.5]); set(gcf, 'renderer', 'painters'); print(gcf, '-dpdf', 'my-figure.pdf'); print(gcf, '-dpng', 'my-figure.png'); print(gcf, '-depsc2', 'my-figure.eps');
You can read more about this on Tobin's article.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With