Hi.
I am trying to produce a horizontal bar chart with error bard, but the error bars minimum value seem completely wrong. Also, the positions of the vertical 'ends' of each error bar appear to be in the wrong position. What am I doing wrong?
Here is the code that produced this chart below:
% data
min = [1e-4 1e-3 1e-2 1e-1 1e1];mean = [1e-3 1e-2 1e-1 1e1 1e2];max = [1e-2 1e-1 1e1 1e2 1e3];cats = categorical({'a','b','c','d','e'});% plot horizontal bars
figure; hold on;p = barh(cats,mean,... 'FaceColor',[0.75,0.75,0.75],... 'EdgeColor','k',... 'LineWidth',1.5,... 'BaseValue',1);baseline = p.BaseLine;% change xscale to 'log'
ax = gca;ax.XScale = 'log';baseline.LineWidth = 1.5;% add y tick labels
ax.YTickLabel = {'cat a','cat b','cat c','cat d','cat e'};% plot error bars
er = errorbar(mean,cats,min,max,'.','horizontal');er.LineWidth = 1.5;er.Color = 'k';er.MarkerSize = 1;
Best Answer