MathGroup Archive 2007

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

Search the Archive

Re: getting data for Histogram

  • To: mathgroup at smc.vnet.net
  • Subject: [mg80487] Re: [mg80428] getting data for Histogram
  • From: DrMajorBob <drmajorbob at bigfoot.com>
  • Date: Thu, 23 Aug 2007 01:15:51 -0400 (EDT)
  • References: <9904841.1187820731820.JavaMail.root@m35>
  • Reply-to: drmajorbob at bigfoot.com

For instance...

Needs["Histograms`"]

data = RandomReal[{1, 10}, 100];
plot = Histogram@data

Cases[plot, Rectangle[{i_, _}, {j_, k_}] :> {{i, j}, k}, Infinity]

{{{1., 2.}, 11}, {{2., 3.}, 13}, {{3., 4.}, 8}, {{4., 5.},
   15}, {{5., 6.}, 11}, {{6., 7.}, 11}, {{7., 8.}, 9}, {{8., 9.},
   7}, {{9., 10.}, 15}}

BinCounts[data]

{11, 13, 8, 15, 11, 11, 9, 7, 15}

The match won't always be this obvious, since Histograms (without options)  
chooses bin-widths adaptively.

To discover the method above, I calculated "plot" and entered

plot//FullForm

to see the histogram's storage structure.

Bobby

On Wed, 22 Aug 2007 03:44:58 -0500, <Arkadiusz.Majka at gmail.com> wrote:

> Hi,
>
> 3 years ago the following problem was given
>
> "I assume that in the process of creating a Histogram plot,
> Mathematica must be calculating a list of BinCounts -- but how can I get  
> at that
> list immediately after making and displaying the histogram? "
>
> Do you know the answer?
>
> arek
>
>
>



-- 

DrMajorBob at bigfoot.com


  • Prev by Date: Re: Outer with index in bounds
  • Next by Date: Re: Re: Re: Cell Bracket Symbols
  • Previous by thread: Re: getting data for Histogram
  • Next by thread: Re: getting data for Histogram