摆脱 matlab 图形的 pdf 输出周围的空白 [英] Get rid of the white space around matlab figure's pdf output
问题描述
我想在 LaTeX 文档中使用我的 matlab 绘图的 PDF 版本.我正在使用带有 PDF 选项的saveas"命令保存数字,但我在 pdf 文件中的绘图周围有很大的空白.这是正常的吗?我怎样才能摆脱它?当然是自动的,因为我有很多"情节.
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.
推荐答案
导出数据以供发布 是一个很好的起点.代替 -deps
使用 -dpdf
输出 pdf.
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');
您可以在 Tobin 的文章中阅读更多相关信息.
You can read more about this on Tobin's article.
这篇关于摆脱 matlab 图形的 pdf 输出周围的空白的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!