[R] Boxplot Labels OK

Rui Barradas ruipbarradas at sapo.pt
Tue Apr 9 20:33:00 CEST 2013


Hello,

The answers you had in another thread could lead you to

bp <- boxplot(DATA$ave, data= DATA, main= "Average Size")
idx <- which(DATA$ave %in% bp$out)
text(x= bp$group, y= bp$out, labels= DATA$num[idx], cex = 0.7, pos = 4)


Hope this helps,

Rui Barradas

Em 09-04-2013 17:31, Beatriz González Domínguez escreveu:
> Dear all,
>
> I have just sent an enquiry but probably I hadn’t expressed myself properly.
>
> Could anyone help me with the following?
>
> When I run the code on my data I get a boxplot with outliers identified by numbers 200 & 201.
> However, what I would like is to label these outliers with their corresponding “DATA$num” values of the data frame.
> In this example, the outliers should be labelled as: 211 & 225
>
> Do you have any idea of how I could do this?
>
> Please, if you need any more details just get in touch.
>
> Many thanks in advance!
>
> ## R CODE
> #DATA
> num <- as.numeric(200:225)
> ave <- c(0.5, 1, 1.6, 2, 2, 2.3, 2.5, 2.4, 3, 3.2, 3.3, 7.2, 4, 4.8, 3.5, 2.7, 3.1, 2.8, 4.1, 2.0, 2.5, 2.1, 3.4, 2.5, 2.6, 7)
> DATA <- data.frame(cbind(num, ave))
> rm(num, ave)
>
> #BOXPLOT
> x11()
> bp <- boxplot(DATA$ave, data= DATA, main= "Average Size")
> identify(x= bp$group, y= bp$out, labels= DATA$num, cex = 0.7)
>
> Bea
> 	[[alternative HTML version deleted]]
>
>
>
> ______________________________________________
> 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.
>



More information about the R-help mailing list