Re: BarChart Range
- To: mathgroup at smc.vnet.net
- Subject: [mg103579] Re: [mg103551] BarChart Range
- From: "David Park" <djmpark at comcast.net>
- Date: Tue, 29 Sep 2009 07:37:05 -0400 (EDT)
- References: <28656482.1254107571753.JavaMail.root@n11>
I may be missing something, some option or other, but this seems to be a
case where set-piece plot design is very nice until you want to step a
little beyond it. The problem here comes if you want to label the bars.
The simple answer to your question is to use ChartElementFunction and write
a bar function that starts at 40 instead of at 0.
g[{{xmin_, xmax_}, {ymin_, ymax_}}, ___] :=
Polygon[{{xmin, 40}, {xmax, 40}, {xmax, ymax}, {xmin, ymax}}]
BarChart[{43.34, 43.60, 44.19, 44.73},
ChartElementFunction -> g,
AxesOrigin -> {0, 40},
PlotRange -> {40, 50}]
Here is the same chart that is labeled above:
BarChart[{43.34, 43.60, 44.19, 44.73},
ChartElementFunction -> g,
ChartLabels -> Placed[{"a", "b", "c", "d"}, Above],
AxesOrigin -> {0, 40},
PlotRange -> {40, 50}]
But there doesn't appear to be any simple method to label the bars just
below the axis. One can spend a lot of time trying to do that. I would be
interested in any suggestions.
Another method is to subtract 40 from all the values:
BarChart[{43.34, 43.60, 44.19, 44.73} - 40,
ChartLabels -> {"a", "b", "c", "d"}]
But now the y tick values are incorrect. You could write your own y ticks
but I would use the CustomTicks in Presentations.
Needs["Presentations`Master`"]
BarChart[{43.34, 43.60, 44.19, 44.73} - 40,
ChartLabels -> {"a", "b", "c", "d"},
Ticks -> {Automatic, CustomTicks[# - 40 &, {40, 50, 1, 5}]},
PlotRange -> Automatic]
Another thing I don't understand in Axis plots is how to specify if the axis
crossing ticks are individually labeled or not. It seems to be a design
omission.
David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/
From: David [mailto:dwarnold45 at suddenlink.net]
All,
I have:
BarChart[{43.34, 43.60, 44.19, 44.73}]
Can someone show me how to set the range to run from 40 to 50?
- Follow-Ups:
- Re: Re: BarChart Range
- From: Brett Champion <brettc@wolfram.com>
- Re: Re: BarChart Range
- From: "David Annetts" <david.annetts@iinet.net.au>
- Re: Re: BarChart Range