RE: help with specify histogram count axis (frequency)
- To: mathgroup at smc.vnet.net
- Subject: [mg43996] RE: [mg43953] help with specify histogram count axis (frequency)
- From: "Wolf, Hartmut" <Hartmut.Wolf at t-systems.com>
- Date: Fri, 17 Oct 2003 05:14:21 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
>-----Original Message----- >From: Peter Sok Chang [mailto:pschang at engin.umich.edu] To: mathgroup at smc.vnet.net >Sent: Wednesday, October 15, 2003 11:00 AM >To: mathgroup at smc.vnet.net >Subject: [mg43996] [mg43953] help with specify histogram count axis (frequency) > > >Hi, > >can anybody help me with specifying the range of the count or frequency >axis (y-axis) for histograms generated by the histogram function? I'm >trying to compare two histograms visually and I would like to keep the >count axis (y-axis) the same. I know the HistogramRange function >specifies the x-axis (value), but there doesn't appear to be a y-axis >counterpart. Thanks. > >----------------------------------------------- >Peter Chang If you want to compare the histograms visually, just put them into the same graph: Needs["Statistics`NormalDistribution`"] << Graphics`Graphics` normdata = RandomArray[NormalDistribution[], 100]; h1 = Histogram[normdata, BarEdgeStyle -> Hue[0], BarStyle -> {}] normdata2 = RandomArray[NormalDistribution[], 100]; h2 = Histogram[normdata2, BarStyle -> {}] Show[h1, h2] BarStyle -> {} will leave the bars unshaded (such as to overlay them), BarEdgeStyle will give the the outlines the color you want. Within the resulting graph, part of the vertical lines will overlap. If that cares, just shift one Graph to the left a bit: h1m = h1 /. Line[{{x1_, y0_}, {_, yy_}, {x2_, _}, __}] :> Line[{{x1 - d, y0}, {x1 - d, yy}, {x2 - d, yy}, {x2 - d, y0}, {x1 - d, y0}}] Show[h1m, h2] Or else make the bars thinner for one: h1n = h1 /. Line[{{x1_, y0_}, {_, yy_}, {x2_, _}, __}] :> Line[{{x1 + d, y0}, {x1 + d, yy}, {x2 - d, yy}, {x2 - d, y0}, {x1 + d, y0}}] h2g = Histogram[normdata2, BarStyle -> GrayLevel[.8]] Show[h2g, h1n] ... -- Hartmut Wolf