Hello every one,
I would like to make a bar graph or something same.
I have cases from 1 up to 18
and each case depending on the problems refers to three categoris(A,B,C).
I do not know how to plot the bar graph, could you please help me with dommands.
thanks.
example
x=1:1:18;
categories= ['A','B','C']
% after soving the problem,
A consists of x numbers from 8-15
B consists of x numbers from 16-18
C consists of x numbers from 1-7
or these distribution can be random.

답변 (2개)

Walter Roberson
Walter Roberson 2021년 12월 21일
편집: Walter Roberson 2021년 12월 21일

0 개 추천

categories = {'A','B','C'};
N = 50;
x = randi(18, 1, N);
cats = categorical(categories);
C = discretize(x, [1, 8, 16, 18]);
counts = accumarray(C(:), 1);
bar(cats, counts)
mehmet salihi
mehmet salihi 2021년 12월 21일

0 개 추천

I guess i explained what i need wrongly,
I have 18 cases, these cases are refering to each group.
I want to show as plot which category what includes.
these cases could be 18 person name or city name.
thank you for your fast answers

카테고리

도움말 센터 및 File Exchange에서 Discrete Data Plots에 대해 자세히 알아보기

질문:

2021년 12월 21일

답변:

2021년 12월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by