Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #10349

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

From "Chris Degnen" <degnen@cwgsy.net>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Histogram ignores 'bspec' (bin spec) ??
Date 2012-06-05 08:52 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jqkhbk$4kf$1@smc.vnet.net> (permalink)
References <jqhr60$klr$1@smc.vnet.net>

Show all headers | View raw


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 
numbers".  You can read this in the 'More information' section here:
 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[1];
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?
>
> 


Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Histogram ignores 'bspec' (bin spec) ?? James Stein <mathgroup@stein.org> - 2012-06-04 08:21 +0000
  Re: Histogram ignores 'bspec' (bin spec) ?? "Chris Degnen" <degnen@cwgsy.net> - 2012-06-05 08:52 +0000
    Re: Histogram ignores 'bspec' (bin spec) ?? Chris Degnen <degnen@cwgsy.net> - 2012-06-07 09:22 +0000
  Re: Histogram ignores 'bspec' (bin spec) ?? "Nasser M. Abbasi" <nma@12000.org> - 2012-06-05 08:55 +0000

csiph-web