Changing the height of baseline in Histograms
- To: mathgroup at smc.vnet.net
- Subject: [mg96105] Changing the height of baseline in Histograms
- From: "D. Grady" <D.C.Grady at gmail.com>
- Date: Thu, 5 Feb 2009 04:38:59 -0500 (EST)
Hi, does anyone know if there's an easy way to change the height of
the baseline for bars in a Histogram? This is different from the
BarOrigin option; here's an example:
x = Clip@RandomReal[NormalDistribution[0, 5], {20000}];
Histogram[
x,
Automatic,
"LogCount"]
Notice that the bottom of the chart is close to 10. This chart is
eventually going into a table with other chart where the y-axis runs
from 0.1 to 10000, so I want to change the range:
Histogram[
x,
Automatic,
"LogCount",
PlotRange -> {-1, 4},
AxesOrigin -> {-1, -1}]
The problem with this is that the bars don't automatically extend
downwards. This can be addressed using the ChartElementFunction
option like this:
correctBaseline[{{xmin_, xmax_}, {ymin_, ymax_}}, values_, meta_] :=
Rectangle[{xmin, -1}, {xmax, ymax}]
Histogram[
x,
Automatic,
"LogCount",
PlotRange -> {-1, 4},
AxesOrigin -> {-1, -1},
ChartElementFunction -> correctBaseline]
Is there a simpler way? I wondered if there's a undocumented option
for setting the baseline height or something like that. Thanks for
any suggestions!
-Daniel