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
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).
Federico
Federico 2013년 1월 18일
편집: Federico 2013년 1월 18일
yes i need histogram's style(every x has two y that i want to representate with rectangular or somithing similar),i don't know what to use...any suggest?
Image Analyst
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
Thorsten 2013년 1월 18일

0 개 추천

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

댓글 수: 1

Federico
Federico 2013년 1월 18일
thank you but this draws function like y = mx + q, i need at least function like x=k with a good thickness

댓글을 달려면 로그인하십시오.

Thorsten
Thorsten 2013년 1월 21일
편집: Thorsten 2013년 1월 22일

0 개 추천

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...

댓글 수: 2

Federico
Federico 2013년 1월 21일
i suppose that values should be,e.g. values = [1 2 3 4] right? i've made a try and bar gives me this error: "??? Error using ==> bar at 54 XData cannot contain duplicate values."
Thorsten
Thorsten 2013년 1월 22일
True. I corrected the code above.

댓글을 달려면 로그인하십시오.

카테고리

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

태그

질문:

2013년 1월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by