matlab绘制条形图并分组显示:

a =[1 2 3]

b =[4 5 6]

>> d=[a;b]

d =

1 2 3
4 5 6

>> bar(d,'group')

matlab绘图基础-LMLPHP

修改横坐标的值为:

>>set(gca,'xticklabel',1:2:5)

matlab绘图基础-LMLPHP

为坐标轴添加说明:菜单Edit->Axes Properties->找到X Axis/Y Axis,->在 X Label/Y Label输入即可。

matlab绘图基础-LMLPHP

matlab绘图基础-LMLPHP

或者菜单Insert->X Label/Y Label

matlab绘图基础-LMLPHP

添加图例:菜单Insert->Legend

matlab绘图基础-LMLPHP

参考:

http://jingyan.baidu.com/article/64d05a02524e63de54f73b76.html

05-11 11:36