单柱状图:
figure(1)
x=[0.000000; 0.000000; 0.000000; 0.000000;0.000000 ;0.000000; 0.000000; 0.010737;0.013601;0.015748;0.010737;0.028633;0.026485;0.040086;0.094488 ;0.240515;0.191124 ;0.186829 ;0.118110 ;0.022906];
b=bar(x);
set(gca,'XTick',0:1:20);
set(gca,'XTickLabel',{'0','1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20'});
legend('geodesic disk spectrum'); %图例
axis([0 21 0.0 0.2])
title(‘title’)
xlabel('Shape index')
ylabel('Ratio')
多组柱状图:
figure(1)
x1=[0.146497 0.073248 0.047771 0.0350320.015924 0.012739 0.025478 0.050955 0.181529 0.410828];
x2=[0.034384 0.068768 0.146132 0.0974210.034384 0.025788 0.034384 0.051576 0.108883 0.398281 ];
x3=[0.077160 0.061728 0.064815 0.0370370.080247 0.067901 0.067901 0.145062 0.182099 0.216049 ];
x4=[0.153094 0.068404 0.052117 0.032573 0.0195440.013029 0.035831 0.058632 0.159609 0.407166 ];
x5=[0.210031 0.047022 0.018809 0.0188090.021944 0.012539 0.040752 0.100313 0.194357 0.335423 ];
x_all=[x1;x2;x3;x4;x5]';
b=bar(x_all);
ch=get(b,'children');
set(gca,'XTick',0:1:10);
set(gca,'XTickLabel',{'0','1','2','3','4','5','6','7','8','9','10'});
legend('PointA','PointB','PointC','PointD','PointE');
xlabel('Bins')
ylabel('Ratio')