[R] Barplots

Philipp Pagel p.pagel at gsf.de
Fri Nov 7 17:24:31 CET 2003


	Hi!

On Fri, Nov 07, 2003 at 10:46:27AM -0500, Suzanne E. Blatt wrote:
> Can anyone tell me how to label individual bars on a barplot?  I want
> to put an "*" or letter ABOVE the bar to denote statistical
> significance.  Is this possible and how?

You can use text() to put arbitrary strings in your plot. So you only
need to add some offset to your y-values and work out the x-positions:

y <- c(10,12,15,8)
lab <- c('*','**','***','*')
barplot(y, ylim=c(0,20), space=0.5)
x <- (0:3*0.5)+1:4 
text(x, y+1, lab, adj=0.5)

cu
	Philipp

-- 
Dr. Philipp Pagel                                Tel.  +49-89-3187-3675
Institute for Bioinformatics / MIPS              Fax.  +49-89-3187-3585
GSF - National Research Center for Environment and Health
Ingolstaedter Landstrasse 1
85764 Neuherberg, Germany




More information about the R-help mailing list