Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: bar chart ticks not placed well?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg106105] Re: [mg106066] bar chart ticks not placed well?
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Fri, 1 Jan 2010 05:37:42 -0500 (EST)
  • Reply-to: hanlonr at cox.net

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-plante 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}]



  • Prev by Date: Re: List to Expression
  • Next by Date: Re: Re: More /.{I->-1} craziness
  • Previous by thread: Re: bar chart ticks not placed well?
  • Next by thread: Re: bar chart ticks not placed well?