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

Home » Public Forums » archive » Re: 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
Re: Last bin of a histogram ? [message #83890 is a reply to message #83889] Wed, 10 April 2013 10:50 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
John Correira writes:

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

It seems to me you are missing the fact that you set MAX=99.5 in the
HISTOGRAM command. Or, am I missing something?

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Are the JHU/APL/S1R libraries still available?
Next Topic: Coyote's Guide to Traditional IDL Graphics Almost Gone

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

Current Time: Fri Oct 10 04:10:10 PDT 2025

Total time taken to generate the page: 0.71817 seconds