How to add error bars to a bar graph

138 views (last 30 days)
Hey, so I have 4 sets of data for which I obtained the mean for each and then created a bar graph. I also used the std command to obtain the standard deviation of each set of data, not sure if that is correct but I wish to create error bars. Here is my code and graph
static_cisplatin=[0.515, 0.453, 0.448, 0.437, 0.344, 0.352, 0.336, 0.318];
static_without=[1.083, 1.419, 1.256, 1.3, 1.612, 1.374, 1.353, 1.354];
spin_cisplatin=[0.342, 0.306, 0.268, 0.312, 0.278, 0.29, 0.267, 0.267];
spin_without=[0.909, 0.964, 0.857, 0.76, 1.095, 0.993, 0.642, 0.418];
A=mean(static_cisplatin);
B=mean(static_without);
C=mean(spin_cisplatin);
D=mean(spin_without);
S1=std(static_cisplatin);
S2=std(static_without);
S3=std(spin_cisplatin);
S4=std(spin_without);
x_axis= categorical({'static cisplatin','static without',...
'spin cisplatin', 'spin without'});
y_axis= [A B C D];
bar(x_axis,y_axis, 0.4)

Accepted Answer

Star Strider
Star Strider on 21 Oct 2020

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!