Search this blog!

Monday, March 12, 2012

Matlab: legend in Errorbar

I want to generate an error bar like this. Here, I am comparing three algorithms and I need three legends. Here is how I did it



y = [2.22153808961105 2.49790518623828 2.78257964160148]; % mean or average
e = [0.539408440954881 1.23204940330217 0.813491394996712]; % 1 standard deviation
figure
errorbar(y,e,'r.');
hold on;
h=plot(1,y(1),'ro',2,y(2),'go',3,y(3),'bo');
legend(h,'feature','feature3x3','cluster','Location','Best');