摆脱Matlab Figure的pdf输出周围的空白 [英] Get rid of the white space around matlab figure's pdf output

查看:578
本文介绍了摆脱Matlab Figure的pdf输出周围的空白的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在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.

推荐答案

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 Figure的pdf输出周围的空白的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆