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

Frank E Harrell Jr f.harrell at vanderbilt.edu
Thu Aug 9 15:09:24 CEST 2007


Gabor Grothendieck wrote:
> You could put the numbers inside the bars in which
> case it would not add to the height of the bar:

I think the Cleveland/Tufte prescription would be much different: 
horizontal dot charts with the numbers in the right margin.  I do this 
frequently with great effect.  The Hmisc dotchart2 function makes this easy.

Frank

> 
> 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



More information about the R-help mailing list