Mathematica中文论坛-非官方
标题:
豆粑粑 matlab 两个子图大小相等,用一个colorbar,
[打印本页]
作者:
meatball1982
时间:
2017-5-12 13:56
标题:
豆粑粑 matlab 两个子图大小相等,用一个colorbar,
老问题了,两个子图,现样大小,画第二个子图的colorbar。图就变小了。通过position设置。
clf;
s1=subplot(1,2,1);
surf(peaks(20));
view(0,90)
axis tight
s2=subplot(1,2,2);
surf(peaks(30));
view(0,90)
axis tight
hb = colorbar('location','southoutside');
%% # Solution:
s1Pos = get(s1,'position');
s2Pos = get(s2,'position');
s2Pos(3:4) = [s1Pos(3:4)];
set(s2,'position',s2Pos);
%% # Alternative method. Brute force placement
set(s1,'Units','normalized', 'position', [0.1 0.25 0.3 0.6]);
set(s2,'Units','normalized', 'position', [0.5 0.25 0.3 0.6]);
set(hb,'Units','normalized', 'position', [0.15 0.1 0.6 0.05]);
复制代码
fig_bottom_one_colorbar.png
(133.45 KB, 下载次数: 1372)
下载附件
2017-5-12 13:56 上传
欢迎光临 Mathematica中文论坛-非官方 (http://ilovemathematica.com/)
Powered by Discuz! X3.2