[R] Text on a boxplot graph

François Le Lay flelay at irisa.fr
Wed Apr 23 15:16:53 CEST 2003


Hi all,

Could anybody help me figure out how to write text on a boxplot. I have to 
plot 9 boxplots side by side on a single graph. On the x-axis I write numeric 
values with the 'names' argument but I'd like to add one label (character 
value) in the middle of each box. I know how to use the text() function for 
regular y~x plots but in this particular case, I'm kinda lost...
Here is my code:

# creating labels for x-axis labelling 
lb <- c()
for( n in names(o) )
  lb <- c(lb, paste("\n",n,"\n",o[[n]], sep=""))

boxplot(x[,-c(10,11)],
        varwidth=TRUE,         			 
col=c("#FF0000","#EE0000","#DD0000","#00FF00","#0000FF","#0000DD","#0000BB","#000099"),	
        col.lab="dark red",
        col.axis="blue",
        main="Boxplots for Polling results, 1868 clusters, 9604 simulated 
requests",
        names=lb,
        xlab="RED BOXPLOTS: precision dependent - GREEN BOXPLOT: null radius - 
BLUE BOXPLOTS: percent of exact radius",
 	       ylab="P(ID) values")


Thanks for your help,
Fanch
 
-- 
IRISA-INRIA, Campus de Beaulieu, 35042 Rennes cedex, France
Tél: +33 (0) 2 99 84 71 00, Fax: +33 (0) 2 99 84 71 71



More information about the R-help mailing list