[R] questions about boxplots

Peter Wolf pwolf at wiwi.uni-bielefeld.de
Tue Sep 27 10:40:50 CEST 2005


concerning question 1:  -- labeling of outliers --

you can get the outliers by boxplot(...)$out

try:

set.seed(17)
x<-rexp(99)
names(x)<-paste("x",1:99)
out<-boxplot(x)$out
text(rep(1.1,length(out)), out, names(out))

Peter Wolf

Stephen D. Weigand wrote:
>Dear Yulei,
>
>On Sep 26, 2005, at 6:56 PM, Yulei He wrote:
>
>  
>>Hi, there.
>>
>>I have two questions about using R to create boxplots.
>>
>>1. The function boxplot() plots the outliers. How can I label the exact
>>values arount these outlier points? Does R have an option allow me to
>>do that?
>>    
>
>You can use identify(). Here's a toy example
>
>set.seed(1)
>y <- rt(30, 3)
>boxplot(y)
>identify(x = rep(1,30), y = y, label = format(y, digits = 2))
>### now click on the outlier in the plot and you should see "-7.398"
>### beside the outlier
>
>  
>>2. How can I put two boxplots in one x-y axis?
>>    
>
>x <- rnorm(10)
>y <- rnorm(20, 3, 5)
>z <- runif(30)
>
>boxplot(x, y, z, labels = c("x", "y", "z"))
>### - or -
>boxplot(list(x = x, y = y, z = z))
>
>
>  
>>Thanks.
>>
>>Yulei
>>
>>    
>
>Stephen Weigand
>Rochester, Minnesota, USA
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>




More information about the R-help mailing list