Hi Everyone, I am trying to create a bar graph with individually colored bars and also with error bars. However I cannot seem to get X axis labels under each bar. I have tried various suggestions from the Answers and File Exchange, but for some reason it's not working for me. Here are two scripts that I have tried (version 2016a):
% first try
X=[1 2 0.25; 2 3 0.55];figurebar(X(1,1),X(1,2),0.5,'FaceColor','b');hold onbar(X(2,1),X(2,2),0.5,'FaceColor','r');hold onerrorbar(X(1:2,2),X(1:2,3),'LineStyle','none','Color','k');set(gca,'XTickLabel',{'Light','Dark'});X=[1 2 0.25; 2 3 0.55];% Second try
figurebar(X(1,1),X(1,2),0.5,'FaceColor','b');hold onbar(X(2,1),X(2,2),0.5,'FaceColor','r');hold onerrorbar(X(1,1),X(1,2),X(1,3),'LineStyle','none','Color','k');set(gca,'XTickLabel','Light');hold onerrorbar(X(2,1),X(2,2),X(2,3),'LineStyle','none','Color','k');set(gca,'XTickLabel','Dark');hold on
Thanks
Best Answer