Hello everybody,
I am new to R and I am having the following problem.
I have the following boxplot:
boxplot(s$Estimate,u$Estimate,names=c("Security", "Usability"))
title(main="Estimated development time",ylab="Estimate (weeks)")
http://i35.tinypic.com/2rhw9rm.jpg
but I want to add a label or symbol for a specific value to every
boxplot. I uploaded a screenshot
of a boxplot I generated using Excel which I try to replicate using R.
In this example, I want to compare my dataset"usability" to a single
value 84 (which is not part of u$Estimate). Is there a way to add a
special symbol/value to every boxplot? Some kind of overlay layer?
http://i35.tinypic.com/24n0020.jpg
I appreciate your help!
Thanks a lot,
Marc
Adding a symbol/value/overlay to a boxplot in R
2 messages · Marc Giombetti, Marc Schwartz
On Nov 5, 2009, at 7:12 AM, Marc Giombetti wrote:
Hello everybody,
I am new to R and I am having the following problem.
I have the following boxplot:
boxplot(s$Estimate,u$Estimate,names=c("Security", "Usability"))
title(main="Estimated development time",ylab="Estimate (weeks)")
http://i35.tinypic.com/2rhw9rm.jpg
but I want to add a label or symbol for a specific value to every
boxplot. I uploaded a screenshot
of a boxplot I generated using Excel which I try to replicate using R.
In this example, I want to compare my dataset"usability" to a single
value 84 (which is not part of u$Estimate). Is there a way to add a
special symbol/value to every boxplot? Some kind of overlay layer?
http://i35.tinypic.com/24n0020.jpg
I appreciate your help!
Thanks a lot,
Marc
As per ?boxplot for the 'at' argument: numeric vector giving the locations where the boxplots should be drawn, particularly when add = TRUE; defaults to 1:n where n is the number of boxes. Thus, each box is drawn at x axis values of 1:2 in the case of your plots above. You can use either text() or points() to add characters or symbols to the plot: set.seed(1) x <- rnorm(100) grp <- rep(1:2, 50) boxplot(x ~ grp) text(1:2, c(-1.5, 1.75), labels = 'x') points(1:2, c(1, -1), pch = 19) See ?text and ?points for more information. HTH, Marc Schwartz