Re: Probability Histogram Problems
- To: mathgroup at smc.vnet.net
- Subject: [mg108616] Re: Probability Histogram Problems
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Thu, 25 Mar 2010 04:26:18 -0500 (EST)
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}, LabelingFunction -> Above, Ticks -> { Range[-.4, .4, .1], Automatic}] Bob Hanlon ---- Don <donabc at comcast.net> 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.