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? 2. How can I put two boxplots in one x-y axis? Thanks. Yulei $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Yulei He 276 Grove St. Apt 3 Newton, MA 02466 617-796-7834(H) 617-432-3428(O) 617-432-3435(fax) $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
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
Try this: result <- boxplot(Petal.Length ~ Species, iris) if (length(result$out)) text(result$group, result$out, result$out, pos = 4, col = "red") On 9/26/05, Yulei He <yuleih at umich.edu> 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? > > 2. How can I put two boxplots in one x-y axis? > > Thanks. > > Yulei > > > $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ > Yulei He > 276 Grove St. Apt 3 > Newton, MA 02466 > 617-796-7834(H) > 617-432-3428(O) > 617-432-3435(fax) > $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ > > ______________________________________________ > 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 >