manually specify occourrences in bar graph
이전 댓글 표시
Hi everyone, i have analyzed some data and now i want to make an histogram,but i can't understand how i can do it.Let me explain, i have 4 values and for each value 2 characteristics: entropy and bandwidth: 1) first value, entropy=1.8 and bandwidth = 18 2) second value, entropy = 0.9 and bandiwidth = 26 ecc...
my aim is to have in x axes my values and y axes the characteristics' value(with different colors)
(if there are others ways to do this,it's ok)
thank you!(and forgive my english)
댓글 수: 3
Image Analyst
2013년 1월 18일
A histogram with only 4 values? Are you kidding me? Perhaps you mean some other kind of graph/plot/visualization instead of a histogram (which is an array of the frequency of occurrence, like a probability density function).
Image Analyst
2013년 1월 18일
Oh, you mean just a bar chart, not a histogram. Even though histograms are often plotted using a bar chart, all bar charts don't depict histograms.
답변 (2개)
Thorsten
2013년 1월 18일
values = [1 2 3 4];
entropy = [1.8 1.9 2.1 2.2];
bandwidth = [18 2 10 11];
hold on
plot(values, entropy, 'r')
plot(values, bandwidth, 'b')
hold off
Sample values
values = [1:4];
entropy = [1.8 1.9 2.1 2.2];
bandwidth = [18 2 10 11];
Plot the bars
h = bar(values, [entropy; bandwidth]');
Color them red and blue:
set(h(1), 'FaceColor', 'r')
set(h(2), 'FaceColor', 'b')
BTW: Please edit your question and remove the histogram stuff such that others can understand my answer...
카테고리
도움말 센터 및 File Exchange에서 Data Distribution Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!