Get errorbars to work with categorical bar plot
古いコメントを表示
I have a set of mean values to plot in a categorical bar plot. However when I add errorbars for the standard deviation it pops up with the errors
Error using errorbar>checkSingleInput (line 271)
YNegativeDelta must be empty or the same size as YData.
Error in errorbar (line 135)
yneg = checkSingleInput(neg, sz, 'YNegativeDelta');
Error in DAE5descriptiv (line 53)
errorbar(y,error)
Anyone got a solution that isn't too complicated to implement? I am using Matlab 2018. I tried posting this problem in our university forum, but apparently my professors were unable to find a solution :P
x = categorical({'Overall','Audio','AudioVisual'}); %Makes 3 categories
y = [70.68,46.92,65.24;69.73,44.15,60.63;71.50,49.31,69.22]; %Mean data
error = [8.4 6.8 8.0 8.4 6.6 7.8 8.4 7.0 8.3]; %SD data
bar(x,y) %Makes bar plot
errorbar(y,error) %NOT WORKING!
legend('Skill','Quality','Pleasantness'); %Gives each color the according name
1 件のコメント
madhan ravi
2019 年 3 月 20 日
Shot in the dark:
errorbar(y(:),error)
回答 (1 件)
KALYAN ACHARJYA
2019 年 3 月 19 日
編集済み: KALYAN ACHARJYA
2019 年 3 月 19 日
whos y
Name Size Bytes Class Attributes
y 3x3 72 double
>> whos error
Name Size Bytes Class Attributes
error 1x9 72 double
Are you looking this one?
x=categorical({'Overall','Audio','AudioVisual'}); %Makes 3 categories
y=[70.68,46.92,65.24;69.73,44.15,60.63;71.50,49.31,69.22]; %Mean data
error = [8.4 6.8 8.0;8.4 6.6 7.8;8.4 7.0 8.3]; %SD data
figure, bar(x,y) %Makes bar plot
figure, errorbar(y,error);
legend('Skill','Quality','Pleasantness'); %Gives each color the according name
Please Note: I did not check the logic of the code

カテゴリ
ヘルプ センター および File Exchange で Errorbars についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!