matlab save figure,没有坐标轴,保存为png 背景透明

matlab save figure,没有坐标轴,保存为png 背景透明

这个是最相关的解决方案:

https://ovcharenkoo.com/transparent-background/

Ghostcript program not found please locate it

https://www.reddit.com/r/matlab/comments/rxb6yf/ghostscipt_installation_not_found_error_even/

plot(cos(linspace(0, 7, 1000)));
set(gcf, 'Position', [100 100 150 150]);
set(gca,'xtick',[],'xticklabel',[]);
set(gca,'ytick',[],'yticklabel',[]);
set(gca, 'Color', 'none'); % Sets axes background
axis off;
export_fig test.png -transparent

效果如下:终于得到了透明的图像

image-20221201124746104

plot(cos(linspace(0, 7, 1000)));
set(gcf, 'Position', [100 100 150 150]);
set(gca,'xtick',[],'xticklabel',[]);
set(gca,'ytick',[],'yticklabel',[]);
set(gca, 'Color', 'none'); % Sets axes background
axis off;
export_fig test.png -transparent -r300;  % 调整图像的清晰度

这个是可以的

plot(dff(14,:));
set(gcf, 'Position', [100 100 150 150]);
set(gca,'xtick',[],'xticklabel',[]);
set(gca,'ytick',[],'yticklabel',[]);
set(gca, 'Color', 'none'); % Sets axes background
axis off;
export_fig('test2.png', '-transparent','-r300');
% export_fig test.png -transparent -r300;

image-20221201125926266

一定要注意,要把

axis off;

加上去,这样就可以把四个边界也给消除掉!

image-20221201151256586
axis off;


加上去,这样就可以把四个边界也给消除掉!

[外链图片转存中...(img-YX3NDtjx-1697010207014)]
  • 1
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值