       Re: Histogram ignores 'bspec' (bin spec) ??

• To: mathgroup at smc.vnet.net
• Subject: [mg126755] Re: Histogram ignores 'bspec' (bin spec) ??
• From: "Chris Degnen" <degnen at cwgsy.net>
• Date: Tue, 5 Jun 2012 04:51:29 -0400 (EDT)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com
• References: <jqhr60\$klr\$1@smc.vnet.net>

```The bin number specification is approximate, grouping to simple numbers.

The legacy version of Histogram had an option called ApproximateIntervals
which would control "whether to adjust the interval boundaries to be simple
http://reference.wolfram.com/mathematica/Histograms/ref/Histogram.html

You can obtain a histogram with exactly 10 bins using the bin width
specification, dx.

I.e. Histogram[foo, {(Max@foo - Min@foo)/(10 - 1)}]

So your code below would be:

SeedRandom;
foo = RandomVariate[NormalDistribution[0, 1], 1000];
{fmin, fmax} = #@foo & /@ {Min, Max};
baz = Table[Histogram[foo, {(fmax - fmin)/(k - 1)}], {k, 8, 15}]
1 == Length[DeleteDuplicates[baz]]

James Stein wrote:
>
> I would like to plot a histogram with a fixed number of bars, e.g. ten
> bars.
> Consider this code:
>
> SeedRandom [ 1 ] ;
> foo = RandomVariate [ NormalDistribution [ 0, 1], 1000 ] ;
> baz = Table [ Histogram [ foo, k ], { k, 8, 15 } ] ;
> 1 == Length [ DeleteDuplicates [ baz ] ]
>
> The last line prints 'True', confirmed by visual inspection of baz which
> reveals eight identical histograms, each containing 13 bins. What do I
> fail
> to understand here?
>
>

```

• Prev by Date: Re: Memory Blowup Issues
• Next by Date: Complex equation+ NDsolve
• Previous by thread: Histogram ignores 'bspec' (bin spec) ??
• Next by thread: Re: Histogram ignores 'bspec' (bin spec) ??