MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Getting histogram information

  • To: mathgroup at
  • Subject: [mg100737] Re: [mg100692] Getting histogram information
  • From: Bob Hanlon <hanlonr at>
  • Date: Thu, 11 Jun 2009 21:46:25 -0400 (EDT)
  • Reply-to: hanlonr at

data = RandomReal[
   NormalDistribution[0, 5*RandomReal[]],
   {RandomInteger[{100, 500}]}];

h = Histogram[data]


bw = Cases[h, RectangleBox[c1_, c2_] -> c2 - c1,
   Infinity][[1, 1]]

Bob Hanlon

---- Raul Martinez <raulmart at> wrote: 


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






(*This will give the number of bins.*)

  • Prev by Date: Re: Getting histogram information
  • Next by Date: Re: AnimationDirection when Exporting
  • Previous by thread: Re: Getting histogram information
  • Next by thread: Re: Getting histogram information