close all;
clear;
clc;
x=zeros(1,60);
y1=zeros(1,60);
data=load('passdatadistance.txt');
for i=1:60
x(i)=i;
tem=data(i)/100+data(i);
end
y1=data;
figure;
bar(x,y1)
title(' 单日平均出行距离分布')
xlabel('出行距离/km')
ylabel('出行人数/人次')
%legend('SVM',1)
axis([0 60 0.0 80000]);
%set(gcf,'color','white')
%set(gca,'xticklabel',x);
x2=[1 2 3 4];%
t1=[28 41 21 5 ];
t2=[29 42 22 4 ];
t3=[28 42 20 4 ];
t=[t1;t2;t3]';
figure;
bar(x2,t)
for i = 1:length(x2)
text(x2(i)-0.3,t1(i),num2str(t1(i),'%g%%'),...
'HorizontalAlignment','center',...
'VerticalAlignment','bottom')
text(x2(i),t2(i),num2str(t2(i),'%g%%'),...
'HorizontalAlignment','center',...
'VerticalAlignment','bottom')
text(x2(i)+0.3,t3(i),num2str(t3(i),'%g%%'),...
'HorizontalAlignment','center',...
'VerticalAlignment','bottom')
end
title(' 换乘次数比例分布')
xlabel('换乘次数')
ylabel('分布比例/%')
legend('2014','2015','2016',3)
axis([0 5 0.0 50]);
set(gca,'xticklabel',{'1','2','3','4'});
由于写论文需要,所以实现了下柱状图的实现实现代码如下,实现效果如下图。
|
请发表评论