MathGroup Archive 2011

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

Search the Archive

Re: BarChart Labeling

  • To: mathgroup at smc.vnet.net
  • Subject: [mg121382] Re: BarChart Labeling
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Tue, 13 Sep 2011 07:19:26 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Reply-to: hanlonr at cox.net

data = RandomReal[{0, 1.}, 10];

BarChart[
 Round[data, .01],
 LabelingFunction -> Above,
 ChartLabels -> Range[10],
 PlotRangePadding -> {None, 0.1}]

BarChart[
 data,
 LabelingFunction -> (Placed[Round[#, .01], Above] &),
 ChartLabels -> Range[10],
 PlotRangePadding -> {None, 0.1}]

BarChart[
 data,
 LabelingFunction -> (Placed[NumberForm[#, {3, 2}], Above] &),
 ChartLabels -> Range[10],
 PlotRangePadding -> {None, 0.1}]


Bob Hanlon

---- Don <donabc at comcast.net> wrote: 

=============
I have spent hours trying to do something that in 
principle is very simple but it's not simple 
in Mathematica unless you stumble across 
 the magic keystrokes.


Here is a bar chart that illustrates the problem. 

data = RandomReal[{0,1.},10]
BarChart[data, LabelingFunction->Above, ChartLabels-> Range[10],
PlotRangePadding->{None, 0.1}]

As you can see, the height numbers above the bars have too many decimal places
to look good on the chart.

Specifically, what is the secret  to getting  the numbers which are the heights of the bars
to be printed in format NumberForm[#, {3,2}] (only two decimal digits)  with 
Style[FontFamily->Arial, Bold, 12].

Thank you in advance.





  • Prev by Date: Re: DiscretePlot filling is darker above axis than below
  • Next by Date: Re: How create new style sheet- Mathematica 8
  • Previous by thread: BarChart Labeling
  • Next by thread: Re: How Can I Make Plot Options Conditional?