comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Last bin of a histogram ?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Last bin of a histogram ? [message #83893] Wed, 10 April 2013 10:33
John Correira is currently offline  John Correira
Messages: 25
Registered: August 2011
Junior Member
I'm trying to understand why HISTOGRAM selects the bins it does. The
final part I don't understand is the last bin. Here is an example

; some fake data
data = RANDOMU(systime(1),1000)*100

; make sure there are some values in the last bin
while N_ELEMENTS(where(data ge 99.5 AND data lt 100.,count)) do $
data = RANDOMU(systime(1),1000)*100

; how many points fall in the last bin?
print, count

h = histogram(data,min=9.5,max=99.5,binsize=.5,locations=locs)
nbins = n_elements(h)

; starting locations of the last few bins
print, locs[nbins-5:nbins-1]

; how many points in the last few bins
print, h[nbins-5:nbins-1]

Why is the last bin returned by the HISTOGRAM function zero? According
to the help, the LOCATIONS keyword returns "the starting locations for
each bin", so to my mind the last bin should include values that fall
between locations[-1] and locations[-1]+binsize. I must be missing
something obvious but I can't see it.



Best regards,

John
[Message index]
 
Read Message
Previous Topic: run-time function creation
Next Topic: Are the JHU/APL/S1R libraries still available?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 18:52:39 PDT 2025

Total time taken to generate the page: 0.00458 seconds