Re: How to change the default setting of BarChart?
- To: mathgroup at smc.vnet.net
- Subject: [mg22418] Re: [mg22394] How to change the default setting of BarChart?
- From: BobHanlon at aol.com
- Date: Wed, 1 Mar 2000 00:40:14 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Needs["Graphics`Graphics`"];
Needs["Statistics`DataManipulation`"];
Needs["Statistics`NormalDistribution`"];
To change the width of the bars, use GeneralizedBarChart
mu = 10*(Random[] - 0.5);
sigma = 4*Random[];
nbrPts = 200;
data = RandomArray[NormalDistribution[mu, sigma], nbrPts];
xmin = Min[Min[data], mu - 3sigma];
xmax = Max[Max[data], mu + 3sigma];
nbrBars = 15;
intrvl = (xmax - xmin)/nbrBars;
freq = Take[BinCounts[data, {xmin, xmin + nbrBars*intrvl, intrvl}],
nbrBars]/(nbrPts*intrvl);
midPts = Table[xmin + (k - 1/2)*intrvl, {k, nbrBars}];
widths = Table[intrvl, {nbrBars}];
Show[{GeneralizedBarChart[Transpose[{midPts, freq, widths}],
DisplayFunction -> Identity],
Plot[PDF[NormalDistribution[mu, sigma], x], {x, xmin, xmax},
PlotStyle -> {AbsoluteThickness[2], Hue[.6]},
DisplayFunction -> Identity]}, DisplayFunction -> $DisplayFunction,
Frame -> True, Axes -> False];
To change the y-axis use the option PlotRange
PlotRange -> {ymin, ymax}
Bob Hanlon
In a message dated 2/27/2000 8:07:00 PM, d8442803 at student.nsysu.edu.tw writes:
>How can I change the width of a bar and the y-axis scale in a BarChart?
>I
>would like to compare 12 different bar charts simultaneously. If the
>scale of y-axis is different, the visualized comparison becomes
>difficult.
>