> How can I plot the number of observations per box in a boxplot.
>
As usual, there's probably a more elegant solution, but this will do it:
p <- rnorm(100)
diddy <- boxplot(z)
text(1, diddy$stats[3]+0.4, paste("n = ", diddy$n))
see ?text and ?boxplot
-
David Hewitt
Virginia Institute o
Try this also:
y<-rnorm(50)
x<-factor(sample(letters[1:5],50,replace=T))
bp <- boxplot(y~x)
text(1:5, bp$stats[3,]+.1, paste("n", bp$n, sep="="))
On 30/01/2008, Marc Bernard <[EMAIL PROTECTED]> wrote:
> Dear all,
>
> How can I plot the number of observations per box in a boxplot. Many thanks,
Here is a variation in which the sample sizes appear under the
labels:
set.seed(1)
y <- rnorm(50)
x <- factor(sample(letters[1:5], 50, replace = TRUE))
bp <- boxplot(y ~ x, varwidth = TRUE)
mtext(paste("(n=", bp$n, ")", sep = ""), at = seq_along(bp$n), line =
2, side = 1)
On Jan 30, 2008 7:30 A
Do you mean something like
y<-rnorm(50)
x<-factor(sample(letters[1:5],50,replace=T))
boxplot(y~x)
text(1:5,rep(min(y),5),paste("n=",tapply(y,x,length)) )
?
(You can fiddle about with the text placement easily enough).
Also note that boxplot's varwidth parameter provides a graphical
indication of
On 1/30/2008 6:42 AM, Marc Bernard wrote:
> Dear all,
>
> How can I plot the number of observations per box in a boxplot. Many thanks,
>
> Bernard
Something like this?
X <- boxplot(count ~ spray, data = InsectSprays, col = "lightgray")
mtext(side=1, line = 2, at = 1:nlevels(Insect
Dear all,
How can I plot the number of observations per box in a boxplot. Many thanks,
Bernard
-
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https://stat.
Dear all,
How can I plot the number of observations per box in a boxplot. Many thanks,
Bernard
-
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https://stat.
7 matches
Mail list logo