Register to reply

Histogram in MATLAB

by Saladsamurai
Tags: histogram, matlab
Share this thread:
Saladsamurai
#1
Jan31-10, 08:31 PM
Saladsamurai's Avatar
P: 3,015
I am having some trouble deciphering how to plot a histogram in MATLAB. My main problem is that I want the x-axis labels to line up with the tick marks. I do NOT want the labels centered and under the bars themselves.

I have been looking into the histc() function here, but have not figured out how to make it plot properly (with bin-edge labels under tick marks).

Anyone know how to do this?
Phys.Org News Partner Science news on Phys.org
Hoverbike drone project for air transport takes off
Earlier Stone Age artifacts found in Northern Cape of South Africa
Study reveals new characteristics of complex oxide surfaces
shoehorn
#2
Jan31-10, 08:58 PM
P: 448
Is there any particular reason why you want to offset the tick marks in this way?
Saladsamurai
#3
Jan31-10, 09:02 PM
Saladsamurai's Avatar
P: 3,015
Hi shoehorn. Yes. That is how I think it should be presented :)
If 10 values fall between 20 and 25, then 20 should be the left mark and 25 should be the right mark and the column should rise up between the 2.

Like this except that I tried this procedure and it does not work reliably every time.

I don't know; I guess I must be insane. I have been looking online for hours. I am surprised that nobody else think that they should be plotted like this. I just checked my textbook's solution manual too and they draw them with the bin values centered under the bar. But that is ambiguous to me. Does that value represent the max or min of the interval? And why should one have to go looking for the interval size? Why should they have to calculate it? These are rhetorical questions of course.... I just think that Plots should be crystal clear so the average bear can read them.

Saladsamurai
#4
Feb1-10, 07:40 PM
Saladsamurai's Avatar
P: 3,015
Histogram in MATLAB

Can anyone confirm if this is even possible? Thanks!
Saladsamurai
#5
Feb6-10, 07:26 PM
Saladsamurai's Avatar
P: 3,015
I did it in Excel for anyone who cares. It was a PITA, but worth it I think. I will post a guide on how to do it once I complete it.

krupashah
#6
Mar27-10, 12:53 AM
P: 3
hi...
histogram program will be there which i used...plz try it
i=imread(image path);
[r,c]=size(i);
val=0:255;
scale=0:255;
for x=1:r
for y=1:c
val(i(x,y))=val(i(x,y))+1;
end
end
figure;
stem(scale,val);


Register to reply

Related Discussions
Simple Histogram using Mathematica - need help please General Math 2
Histogram relevent? Advanced Physics Homework 0
Physics histogram help Introductory Physics Homework 2
Histogram = PDF? Set Theory, Logic, Probability, Statistics 3