I recently had a question come in via e-mail where this MATLAB user wanted to be able to change the look of her histogram. The key to this problem was using HIST to generate the binning data and then use the more flexible BAR to make the bar chart look exactly as she wished. If HIST is used without a left hand side argument, then the function will make a plot using some default choices. If you want more control over the graph, you will have to use the flexibility of BAR to do that.
Hi Doug,
i want to ask you a question.
I want a function which creates a histogram where the x axis will consist words and y axis numbers. For example, i have the names {‘Paul’ ‘Kate’ ‘John’ ‘Alex’} and their ages {23 40 16 32} in a cell array 4×2. I want the names at x axis and ages at y axis.
Is there any function to do this?
Hi Doug
i would like to use hist command to help to plot a frequency table with class size of 5, is it possible?
eg:
input=1 2 3 7 8 9
table=
[ 1-5 3 ;
6-10 3 ]
Hi doug,
can I ask you a question about the histogram of an image?
Here the simple code:
N=200;
A=randn(N,N);
imshow(A), figure, imhist(A), axis tight
The histogram does not look right. I am expecting a Gaussian looking centered at zero…
thanks a lot,
Marco
Marco—imhist assumes a dynamic range of [0,1] when you pass it a floating-point image, so it uses bins in that range.
Can I have some tips on how to write a MATLAB code to plot a histogram without using the function “hist”
Thanks,
Shalini
@Shalini,
Why would you want to?
You can use the output from hist as input to BAR.m if you want finer control.
I’m supposed to write a code for a histogram without using the hist function
@shalini
>>edit hist
Take a look at how it was implemented.
Is it possible to put error bars for a histogram. the error bar will be the standard deviation of the values used to plot the histogram.
Chitra
Never tried this, but it might work:
http://www.mathworks.com/matlabcentral/fileexchange/25613-barrerror-utility-for-bar-plots-with-automatic-error-bars
Hi Doug,
i want to ask you a question.
I want a function which creates a histogram where the x axis will consist words and y axis numbers. For example, i have the names {‘Paul’ ‘Kate’ ‘John’ ‘Alex’} and their ages {23 40 16 32} in a cell array 4×2. I want the names at x axis and ages at y axis.
Is there any function to do this?
Thanks a lot..
@maria,
You can change the ‘yTickLabel’ property of the axes with set.
Doug
Hi Doug
i would like to use hist command to help to plot a frequency table with class size of 5, is it possible?
eg:
input=1 2 3 7 8 9
table=
[ 1-5 3 ;
6-10 3 ]
thx a lot =)
@Winnie,
You will want to choose the bins specifically as shown in the documentation for HIST.