二维柱状图,
bar(a)
也可设置柱状图的宽度
注意当x轴 上的label过多,比如 超过15个时,则只显示5个。
close all;
clear all;
clc;
figure('position',[150,100,900,550])
a=xlsread('ME.xlsx');
h1=bar(a);
set(gca,'XTickLabel',{'5','10','15','20','25'},'FontSize',10,'FontName','Times New Roman')
set(h1(1),'FaceColor',[30,150,252]/255)
set(h1(2),'FaceColor',[162,214,249]/255)
% ylim([0,16]);
%
ylabel('\fontname{Times new roman}\fontsize{10}ME(mm)');
xlabel('\fontname{Times new roman}\fontsize{10}Points');
str1='\fontsize{9}\fontname{Times New Roman}x-axis';
str2='\fontsize{9}\fontname{Times New Roman}y-axis';
legend(str1,str2,'location','NorthWest');
单个在柱状图
close all;
clear all;
clc;
figure('position',[600,100,400,250])
a=xlsread('yi.xls');
h=bar(a);
set(h(1),'FaceColor',[30,150,252]/255)
axis([0 100 0 35]);
set(gca,'xtick',(0:20:100),'ytick',(0:10:35));
set(gca,'FontName','Times New Roman','FontSize',10,'LineWidth',0.5); %设置坐标轴
ylabel('\fontname{Times new roman}\fontsize{10}Number of coincidence points');
xlabel('\fontname{Times new roman}\fontsize{10}Number of tests');