[R] Subject: Re: how to include bar values in a barplot?

Greg Snow Greg.Snow at intermountainmail.org
Thu Aug 9 18:07:50 CEST 2007


Gabor,

Putting the numbers in the bars is an improvement over putting them over
the bars, but if the numbers are large relative to the bars, this could
still create a "fuzzy" top to the bars making them harder to compare.
This also has the problem of the poorly laid out table, numbers are
easiest to compare if they are aligned (and vertical comparisons are
easier than horizontal).

There is also the issue of scale.  You can shrink a barplot quite a bit
and still get a good overview of the relationships, but if you need the
numbers inside the plot, then either the numbers become to small to
easily read, or the numbers stay big and overwhelm the plot.

The best approach is to switch to a dotplot with the numbers in the
margin (Frank has suggested this as well).  If you need to stay with the
bar plot (some lay people are still more comfortable with them until we
can educate them to prefer the dot plots) then I would suggest doing
horizontal bars with the numbers in the margin (vertically aligned).  If
the vertical bars are necessary, then putting the numbers below the bars
(but separated enough that they don't interfere with a clear zero point)
seems the safest approach.
 

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at intermountainmail.org
(801) 408-8111
 
 

> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch 
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Gabor 
> Grothendieck
> Sent: Thursday, August 09, 2007 6:55 AM
> To: Frank E Harrell Jr
> Cc: r-help at stat.math.ethz.ch; ted.harding at manchester.ac.uk
> Subject: Re: [R] Subject: Re: how to include bar values in a barplot?
> 
> You could put the numbers inside the bars in which case it 
> would not add to the height of the bar:
> 
> x <- 1:5
> names(x) <- letters[1:5]
> bp <- barplot(x)
> text(bp, x - .02 * diff(par("usr")[3:4]), x)
> 
> On 8/9/07, Frank E Harrell Jr <f.harrell at vanderbilt.edu> wrote:
> > Ted.Harding at manchester.ac.uk wrote:
> > > Greg, I'm going to join issue with your here! Not that 
> I'll go near 
> > > advocating "Excel-style" graphics (abominable, and the 
> Patrick Burns 
> > > URL which you cite is remarkable in its restraint). Also, 
> I'm aware 
> > > that this is potential flame-war territory --  again, I want to 
> > > avoid that too.
> > >
> > > However, this is the second time you have intervened on 
> this theme 
> > > (previously Mon 6 August), along with John Kane on Wed 1 
> August and 
> > > again today on similar lines, and I think it's time an 
> alternative 
> > > point of view was presented, to counteract (I hope usefully) what 
> > > seems to be a draconianly prescriptive approach to the 
> presentation 
> > > of information.
> >
> >
> > ---snip---
> >
> > Ted,
> >
> > You make many excellent points and provide much food for 
> thought.  I 
> > still think that Greg's points are valid too, and in this 
> particular 
> > case, bar plots are a bad choice and adding numbers at variable 
> > heights causes a perception error as I wrote previously.
> >
> > Thanks for your elaboration on this important subject.
> >
> > Frank
> >
> > >
> > > On 07-Aug-07 21:37:50, Greg Snow wrote:
> > >> Generally adding the numbers to a graph accomplishes 2 things:
> > >>
> > >> 1) it acts as an admission that your graph is a failure
> > >
> > > Generally, I disagree. Different elements in a display serve 
> > > different purposes, according to the psychological 
> aspects of visual preception.
> >
> > . . .
> >
> > --
> > Frank E Harrell Jr   Professor and Chair           School 
> of Medicine
> >                      Department of Biostatistics   
> Vanderbilt University
> >
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide 
> > http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list