老问题了,两个子图,现样大小,画第二个子图的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]);
复制代码
|