Effacer les filtres
Effacer les filtres

How to create a stacked bar plot with error bars?

4 vues (au cours des 30 derniers jours)
DrWooo
DrWooo le 1 Déc 2017
Commenté : Star Strider le 2 Déc 2017
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 commentaire
Star Strider
Star Strider le 2 Déc 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.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Discrete Data Plots dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by