一个简单的选择是将轴的clipping
属性设置为 off
。
bar(data,'stack')
colormap('lines') % make it colorfull :)
bax = gca; % get axis handle
bax.Clipping = 'off';
bax.YLim(2) = 600; % set the upper limit
为了获得更好的结果,您可能还希望将坐标轴缩小一点,这样条形图就会保持在图像内。同时,不勾画坐标轴会更美观:
top = bax.YLim(2); % before you change the limit
bax.YLim(2) = 600; % set the upper limit
bax.Position(4) = bax.Position(4)*(bax.YLim(2)/top);
box off
结果:
clipping
属性。 - Luis Mendo