文本
text(x(maxIndex), maxVal, {[' X: ' num2str(x(maxIndex))];[' Y: ' num2str(maxVal)]})
其中,x(maxIndex), maxVal是文本位置,{[…];[…]}是所写文字。
效果如下:
坐标轴
%调整坐标轴刻度
XLim= get(gca,'XLim');
YLim= get(gca,'YLim');
XLim = XLim + [-1 0] * 0.01 * diff(XLim);
YLim = YLim + [-1 0] * 0.01 * diff(YLim);
set(gca,'xlim',XLim,'ylim',YLim);
%显示最小刻度、设置坐标轴标签
set(gca,'XMinorTick','on','YMinorTick','on','XTick',0:1:24);
颜色
% 添加颜色柱条并写说明、换颜色
h = colorbar;
h.Label.String = 'P';
colormap(jet);
网友评论