subplot(2,2,1) m_contourf(lon_real,lat_real,spring_mean') colormap(m_colmap('jet','step',100)); m_gshhs('fc','patch',[0.8 0.8 0.8]); m_grid('box','fancy','fontsize',12); h=colorbar('eastoutside'); title('春季','fontsize',12); title(h,'°C','color','k'); subplot(2,2,2) m_contourf(lon_real,lat_real,summer_mean') colormap(m_colmap('jet','step',100)); m_gshhs('fc','patch',[0.8 0.8 0.8]); m_grid('box','fancy','fontsize',12); h=colorbar('eastoutside'); title('夏季','fontsize',12); title(h,'°C','color','k'); subplot(2,2,3) m_contourf(lon_real,lat_real,autumn_mean') colormap(m_colmap('jet','step',100)); m_gshhs('fc','patch',[0.8 0.8 0.8]); m_grid('box','fancy','fontsize',12); h=colorbar('eastoutside'); title('秋季','fontsize',12); title(h,'°C','color','k'); subplot(2,2,4) m_contourf(lon_real,lat_real,winter_mean') colormap(m_colmap('jet','step',100)); m_gshhs('fc','patch',[0.8 0.8 0.8]); m_grid('box','fancy','fontsize',12); h=colorbar('eastoutside'); title('冬季','fontsize',12); title(h,'°C','color','k'); 该如何使得四图之间的间隙变小,代码
时间: 2023-08-06 18:07:43 浏览: 79
可以通过调整 subplot 之间的间距来实现四图之间的间隙变小,可以使用 `subplot_tight` 函数来实现。
可以将原来的代码改成以下形式:
```
figure;
subplot_tight(2, 2, 1, [0.05, 0.05]);
m_contourf(lon_real,lat_real,spring_mean');
colormap(m_colmap('jet','step',100));
m_gshhs('fc','patch',[0.8 0.8 0.8]);
m_grid('box','fancy','fontsize',12);
h=colorbar('eastoutside');
title('春季','fontsize',12);
title(h,'°C','color','k');
subplot_tight(2, 2, 2, [0.05, 0.05]);
m_contourf(lon_real,lat_real,summer_mean');
colormap(m_colmap('jet','step',100));
m_gshhs('fc','patch',[0.8 0.8 0.8]);
m_grid('box','fancy','fontsize',12);
h=colorbar('eastoutside');
title('夏季','fontsize',12);
title(h,'°C','color','k');
subplot_tight(2, 2, 3, [0.05, 0.05]);
m_contourf(lon_real,lat_real,autumn_mean');
colormap(m_colmap('jet','step',100));
m_gshhs('fc','patch',[0.8 0.8 0.8]);
m_grid('box','fancy','fontsize',12);
h=colorbar('eastoutside');
title('秋季','fontsize',12);
title(h,'°C','color','k');
subplot_tight(2, 2, 4, [0.05, 0.05]);
m_contourf(lon_real,lat_real,winter_mean');
colormap(m_colmap('jet','step',100));
m_gshhs('fc','patch',[0.8 0.8 0.8]);
m_grid('box','fancy','fontsize',12);
h=colorbar('eastoutside');
title('冬季','fontsize',12);
title(h,'°C','color','k');
```
其中,`subplot_tight` 的第四个参数是一个长度为2的向量,用来设置左右和上下的间距。可以根据需要进行调整。
阅读全文