matlab控制图像的边界(margin),subplot的间距(gap)

在MATLAB中,通常子图的间距和边界由系统自动调整。要按需定制这些设置,可以使用自定义函数。文章介绍了如何通过tight_subplot函数控制子图的行数、列数、垂直和水平间距以及图像与figure边缘的距离。示例代码演示了如何应用这些参数,并特别提到对于imshow()显示的图像同样适用。同时,文中提到了相关参考资料。
摘要由CSDN通过智能技术生成
                       

使用subplot(row, col, i)创建的子图,matlab会隐式地调整它们的间距以及它们和整个figure的边距,以达到它所认为的美观或者合理的设置,然而如果我们想根据需求设置合理的间距以及边距,该怎么定制呢?

这里提供一个函数(是在没必要把时间花费在这种繁琐的格式上):

function ha = tight_subplot(Nh, Nw, gap, marg_h, marg_w)% tight_subplot creates "subplot" axes with adjustable gaps and margins%% ha = tight_subplot(Nh, Nw, gap, marg_h, marg_w)%%   in:  Nh      number of axes in hight (vertical direction)%        Nw      number of axes in width (horizontaldirection)%        gap     gaps between the axes in normalized units (0...1)%                   or [gap_h gap_w] for different gaps in height and width %        marg_h  margins in height in normalized units (0...1)%                   or [lower upper] for different lower and upper margins %        marg_w  margins in width in normalized units (0...1)%       
  • 4
    点赞
  • 18
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值