Re: bar chart ticks not placed well?

*To*: mathgroup at smc.vnet.net*Subject*: [mg106216] Re: bar chart ticks not placed well?*From*: r_poetic <radford.schantz at mms.gov>*Date*: Tue, 5 Jan 2010 01:46:27 -0500 (EST)*References*: <hhkj8q$56f$1@smc.vnet.net>

On Jan 1, 5:37 am, Bob Hanlon <hanl... at cox.net> wrote: > First, the BarSpacing must be set to zero. Then there must be a slight shift of 1/2 to put the ticks in the middle of the bars. This latter issue is more evident for small n (look also at n=10). > > n = 100; > > s = 2^n; > > slist = Table[Binomial[n, k]/s, > {k, 0, n}]; > > Total[slist] > > 1 > > Show[{BarChart[slist, > Ticks -> { > Table[{k + 1/2, k}, {k, n/10, n, n/10}], > Automatic}, > BarSpacing -> 0, > ImageSize -> 400], > Plot[Interpolation[ > Thread[{Range[0, n], slist}]][x - 1/2], > {x, 1/2, n + 1/2}, > PlotRange -> All, > PlotStyle -> Directive[Red, Thick]]}] > > Bob Hanlon > > ---- rs_poetic <schantz-pla... at cox.net> wrote: > > ============= > Hello, > in this simple bar chart, there are 101 bars (some of them very small > and including 0 and 100). The x axis labels appear to be shifted a bit > to the left. The apparent misplacement is enough to be noticed and to > confuse the reader. Am I using the wrong command, or....? > > s = Sum[Binomial[100, k], {k, 0, 100}]; > slist = Table[Binomial[100, k], {k, 0, 100}]; > labellist = Table[k, {k, 0, 100, 25}];BarChart[N[slist/s], Ticks -> {labellist, Automatic}] Thanks! I appreciate both solution and the extra material about interpolation. RS