Re: Getting histogram information
- To: mathgroup at smc.vnet.net
- Subject: [mg100701] Re: Getting histogram information
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Thu, 11 Jun 2009 21:39:47 -0400 (EDT)
- Organization: Uni Leipzig
- References: <h0qoi1$klv$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
Hi, BinCounts[] is your friend .. Regards Jens Raul Martinez wrote: > All, > > I have used the Histogram[] function many times. It works well and has > lots of options but seems to lack transparency. > > Specifically, if I don't specify a bin width and let the function > compute it, I want to know exactly what bin width the function used. > Obviously, with some additional work I can infer the bin width from > the resulting histogram. It would be better, however, to know > precisely the bin width that the function actually used. > > I consulted Wolfram support about this and they were helpful, > providing me with a bit of clever but rather obscure code that returns > the populated histogram bins. But this still requires additional work > to infer the bin width. The code provided by Wolfram support is listed > after the signature. > > Can anyone figure out how to get the bin width directly from the > Histogram[] function? > > Thanks in advance. > > Raul Martinez > > Code: > > data1=RandomReal[NormalDistribution[0,1],100]; > > h > = > Reap > @Histogram[data1,Automatic,Function[{xbins,counts},Sow[counts];counts]] > > h[[2]] > > h[[2,1,1]] > > (*This will give the number of bins.*) > h[[2,1,1]]//Length > >