[R] add information above bars of a barplot()

Greg Snow Greg.Snow at imail.org
Mon Mar 22 18:58:25 CET 2010


Adding text at the top of the bars will tend to distort the perception of their heights.  It is better to place numbers (if they are even needed) in the margins.  Switching to a dotplot instead of a barplot may be more meaningful as well.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Martin Batholdy
> Sent: Monday, March 22, 2010 8:53 AM
> To: r help
> Subject: [R] add information above bars of a barplot()
> 
> hi,
> 
> 
> I have a barplot with six clusters of four bars each.
> Now I would like to add the exact value of each bar as a number above
> the bar.
> 
> I hoped to get some tips here.
> I could simply add text at the different positions, but I don't
> understand how the margins on the x-axis are calculated
> (how can I get / calculate the x-ticks of a barplot?).
> 
> Also I would like to code this flexible enough so that it still works
> when I have more bars in each cluster.
> 
> 
> 
> thanks for any suggestions!
> 
> ______________________________________________
> R-help at r-project.org 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