tags:

views:

77

answers:

3

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.

Thanks.

+2  A: 

Exporting Figures for Publication is a good starting point. Instead of -deps use -dpdf for pdf output.

EDIT: I wasn't aware of the bounding box issue with pdf. But Tobin solved it.

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');
zellus
+2  A: 

Here is a less painful solution than Tobin's: http://tipstrickshowtos.blogspot.com/2010/08/how-to-get-rid-of-white-margin-in.html

eakbas
+2  A: 

In addition to the other suggestions here, you might also try to use the LooseInset property as described in http://UndocumentedMatlab.com/blog/axes-looseinset-property/ to remove extra space around your plot axes.

Yair Altman