필터 지우기
필터 지우기

Example from Bar Graph Plot doesn't function in R2019a #categorical

조회 수: 2 (최근 30일)
Franciszek Aniol
Franciszek Aniol 2022년 3월 6일
댓글: Franciszek Aniol 2022년 3월 6일
When i try the example code:
X = categorical({'Small','Medium','Large','Extra Large'});
X = reordercats(X,{'Small','Medium','Large','Extra Large'});
Y = [10 21 33 52];
bar(X,Y)
from: https://de.mathworks.com/help/matlab/ref/bar.html @ Specify Categorical Data
i get this:
Error using bar (line 222)
Data inputs must match the axis configuration. A numeric axis must
have numeric data inputs or data inputs which can be converted to
double.
Error in Untitled (line 5)
bar(X,Y)
My use case is this following Bar Plot:
Due to how bar plot is configured i find it, much more different to access each bar seperately.
With my code ending as such:
b = bar(data_total.x , data_total.mean,'FaceColor','flat');
random.a = 0;
random.b = 1;
for n = 1:6
random.r = (random.b-random.a).*rand(3,1) + random.a;
b.CData(n,:)= random.r;
end
er = errorbar(data_total.x , data_total.mean, data_total.errhigh, data_total.errlow);
er.Color = [0 0 0];
er.LineStyle = 'none';
Is there a more elegant solution to make the graph easier to read in this case?
Can I plot multiple bar graphs in to a single plot?
If not how do I write 'strings' / text in the x axis of this bar plot?
with regards,
Franek

답변 (0개)

카테고리

Help CenterFile Exchange에서 Bar Plots에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by