manually specify occourrences in bar graph
Show older comments
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 Comments
Image Analyst
on 18 Jan 2013
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
on 18 Jan 2013
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.
Answers (2)
Thorsten
on 18 Jan 2013
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...
Categories
Find more on Data Distribution Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!