How to create a stacked bar plot with error bars?
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello,
I have a set of data split into two uneven categories. Each category contains measurements for three variables: total, organic and inorganic.
I would like to create a stacked bar plot (with a single bar on the xaxis for each category). Within each bar, I would like to plot the organic and inorganic values as stacked. If possible, I would also like to have an error bar appear at the top of each bar displaying +/- 1 standard deviation for the averaged total.
I tried by starting to plot one of the values in a bar graph, and received an error that xdata cannot contain duplicate values:
x = B(1:59,3) %Where B is the predefined excel file; B(1:36,3) = 1 and B(37:59,3) = 2
T = B(1:59,9) %Total values
O = B(1:59,10) %Organic values
I = B(1:59,8) %Inorganic values
for x = B(1:36,3)
y = (1:36,10) %Organic values
figure(1)
bar(x,y1)
end
Any suggestions or insight are welcome; this is my first time attempting a simple bar plot.
Cheers
1 Kommentar
Star Strider
am 2 Dez. 2017
Please provide an illustration of the sort of plot you want as the result.
The reason for asking is that standard error (or confidence interval) bars on a stacked bar plot would be difficult for someone looking at the plot to interpret. A reviewer/referree (and I have been one) might not accept a paper with confusing graphics.
Antworten (0)
Siehe auch
Kategorien
Mehr zu Line Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!