如何在Matlab中得到透明背景的图片?

2005-11-10

MATLAB输出的矢量图往往不是透明背景的,这样插在ppt中就会很难看,就像贴了膏药似的。关于在MATLAB中如何得到透明背景的矢量图,我有个经验就是:用MATLAB导出pdf图形(而不是eps图形),然后用Acrobat另存成eps图形,往往就是透明的了。不过,如果一个图形包含多个子图,那么很可能只有第一个子图的背景是透明的,其余子图背景仍为白色。

附:
by alexxl 2006-02-11

在网上发现如下codes,可以生成透明图形。

% If you ever wondered how to get a matlab figure transparent (particularly usefull when you export it to formats that feature transparency, like eps, gif, png, etc.), here is how you do it:

% you created a figure and it is "current". % the following, you could have guessed
set(gcf,'color','none');
set(gca,'color','none');
% but this following little detail took me ages to figure out
set(gcf,'InvertHardCopy','off');

打开一个.fig的文件,在command中运行上面三行命令 Edit->Copy Figure->在powerpoint中粘贴,就得到背景透明的图片。

 

你可能感兴趣的:(MATLAB)