首先绘制条形图 主要采用matlab自带的bar命令
a_live = [0.9186, 0.9460, 0.9552, 0.9533];
a_tid = [0.6090, 0.6663, 0.7170, 0.7165];
a = [a_live; a_tid];
bar(a, 'grouped')
set(gca,'YLim', [0.5,1], 'XTickLabel',{'LIVE', 'TID2013'}, 'FontSize', 15);
ylabel('SRC');
set(gca, 'Ytick', [0.5:0.05:1], 'ygrid','on','GridLineStyle','-');
legend('25','50','100','200', 'Location', 'EastOutside');
legend('boxoff');
采用errorbar命令添加误差棒,这里的误差是标准差。
e = [0.0198, 0.0124, 0.0096, 0.0112; 0.0875, 0.0990, 0.1034, 0.0939];
hold on
numgroups = size(a, 1);
numbars = size(a, 2);
groupwidth = min(0.8, numbars/(numbars+1.5));
for i = 1:numbars
% Based on barweb.m by Bolu Ajiboye from MATLAB File Exchange
x = (1:numgroups) - groupwidth/2 + (2*i-1) * groupwidth / (2*numbars); % Aligning error bar with individual bar
errorbar(x, a(:,i), e(:,i), 'k', 'linestyle', 'none', 'lineWidth', 1);
end
最后采用一个toolbox: applyhatch_pluscolor_bundle来改变条形图的形状,方便黑白打印的时候显示
[im_hatch,colorlist] = applyhatch_pluscolor(1,'\+x.', 1, [1,0,1,0] , [], [], 1.5, 2); % add different patterns
————————————————
版权声明:转载仅作为笔记使用。本文为CSDN博主「raul678」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/raul678/article/details/50344755