Barplot with errorbar for matrix of variances
Show older comments
Hi
I have the following 5x6 matrix
A = [1 16 12 7 9 5; 4 18 7 8 9 10; 7 8 10 9 14 17; 13 15 9 8 4 12; 8 7 23 9 12 11]
Each column of the matrix represents a different city, and each row a different year. With bar(A) I easily can plot a barplot with each of the 5 years grouped together, and each year containing one bar for each city.
Now I also have the 5x6 matrix varia, which contains the variances for each entry in the matrix A. So for instance, varia(1,1) is the variance of the data collected for city1 in the year1, and should be used in the bar for city1 and year1 as an error bar - how can that be done?
I tried:
bar(A)
errorbar(A,varia,'.')
Error:
Error using errorbar (line 74) X, Y and error bars must all be the same length
Error in exampleScript (line 31) errorbar(A,varia)
Accepted Answer
More Answers (0)
Categories
Find more on Discrete Data Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!