[R] boxplot - label outliers
S Ellison
S.Ellison at lgc.co.uk
Wed Sep 3 12:00:02 CEST 2008
Sherri;
The boxplot stats include outlier values in $out and their group number
in $group.
Let me assume that you want to put the boxes at integer positions on
the x-axis (the default is the same). The we have
y<-rnorm(60)
g<-gl(3,20)
labels=paste("Value", 1:length(y))
bx<-boxplot(y~g)
bx.at<-1:3
bx<-boxplot(y~g, at=bx.at)
for(i in unique(bx$group)) {
text(bx.at[i], m<-max(bx$out[bx$group==i]), labels[which(y==m)],
pos=4)
}
#We could possibly use tapply to label the outliers by group, but this
for loop labels the maximum outlier.
#This toy version will do that if the outliers are below the box too,
which is silly,
#so you'll need to finagle it a bit to get the 'outermost' outlier
labelled.
>>> Sherri Heck <sheck at ucar.edu> 02/09/2008 22:37 >>>
Hi All-
I have 24 boxplots on one graph. I do not have the whiskers extending
to the outliers, but I would like to label the maximum value of each
outlier above the whiskers. I have the stats but am having trouble
figuring out how to label the whiskers.
Any suggestions would be great!
sherri
______________________________________________
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.
*******************************************************************
This email and any attachments are confidential. Any use...{{dropped:8}}
More information about the R-help
mailing list