matlab 中图的大小_如何在MATLAB图形中设置子图大小?

在MATLAB中,通过默认的subplot函数创建10个图像时,图像可能不会充分利用屏幕空间。要增加图像大小或减少子图之间的间距,可以使用subplot的'position'参数来手动设置子图的位置和大小。或者,获取子图句柄并随后修改其位置属性。提供的代码示例详细说明了如何实现这一目标,通过调整坐标和计算每个子图的宽度和高度,以达到所需的布局效果。
摘要由CSDN通过智能技术生成

I often need to plot 10 images together, but using this code results in small images :

img = rand(400,600);

for i=1:10

subplot(2,5,i);

imshow(img);

title(['Image ' int2str(i)]);

end

As you can see, the images do not use all available space in the screen. How can I increase the size, or decrease the padding/margin between them?

Thanks for any help.

解决方案

I don't believe there is an easy way to do it. There are two options:

First, use the position part of the subplot:

>> subplot(2,5, i, [l, b, w, h])

and calculate the left, bottom, width, height.

Or, get the handle of the returned axis:

>> h(i) = subplot(2,5,i);

and then modify the axis afterward.

>> set(h(1), 'positio

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值