From: Don on 24 Mar 2010 05:31 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.
From: Bob Hanlon on 25 Mar 2010 05:25 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(a)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.
From: Bob Hanlon on 25 Mar 2010 05:27 Change that to Ticks -> { Range[minBinEndPt, maxBinEndPt, binSize], Automatic} Bob Hanlon ---- Bob Hanlon <hanlonr(a)cox.net> wrote: ============= 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(a)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.
From: dh on 25 Mar 2010 05:28 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(a)metrohm.com> Internet:<http://www.metrohm.com>
|
Pages: 1 Prev: Tube plot function in Mathematica??? Next: Calling kernel.dll from |