Re: Probability Histogram Problems
- To: mathgroup at smc.vnet.net
- Subject: [mg108627] Re: Probability Histogram Problems
- From: dh <dh at metrohm.com>
- Date: Thu, 25 Mar 2010 04:28:31 -0500 (EST)
- References: <hocm58$scl$1@smc.vnet.net>
Hi Don,
look up "LabelingFunction" and "Ticks". Here is your example:
Histogram[data, {binSize}, "Probability",
PlotRange -> {{minBinEndPt, maxBinEndPt}, Automatic},
AxesOrigin -> {minBinEndPt, 0}, LabelingFunction -> Above,
Ticks -> {Range[-.4, .4, .1], Automatic}]
Daniel
On 24.03.2010 10:31, Don wrote:
> I would like to have probability histograms that have the same
> minimum and maximum bin end points
> for easy comparison of histograms across multiple data sets. I want
> to be able to explicity control the end points of the histogram, even
> if there is
> no data in the minimum and maximum bins.
>
> For example, here is a probabilty histogram with min bin end point of
> -.4
> and maximum bin end point of .4 (and a bin size of 0.1)
>
> minBinEndPt = -.4;
> maxBinEndPt = .4;
> binSize = .1;
> data = {-0.21`, -0.2`, -0.19`, -0.1`, -0.05`, 0.21`, 0.2`, 0.19`,
> 0.1`, 0.05`};
>
> Histogram[data, {binSize}, "Probability",
> PlotRange -> {{minBinEndPt, maxBinEndPt}, Automatic},
> AxesOrigin -> {minBinEndPt, 0}]
>
> I would like to improve this probablity histogram in
> two ways:
>
> (1) Have each one of the bin end points labeled and not just every
> other one which is how it looks in the graph now.
>
> (2) Label on top of each bar the exact height of the bar (the
> probability). These labels
> for the probability histogram above may be calculated from:
>
> topBarLabels =
> N[BinCounts[data, {minBinEndPt, maxBinEndPt, binSize}] /
> Length[data]]
>
> But how does one get the topBarLabels to be at the top of each
> respective
> bar in the histogram above?
>
> Thank you in advance.
>
--
Daniel Huber
Metrohm Ltd.
Oberdorfstr. 68
CH-9100 Herisau
Tel. +41 71 353 8585, Fax +41 71 353 8907
E-Mail:<mailto:dh at metrohm.com>
Internet:<http://www.metrohm.com>