[R] boxplot and stripchart
Peter Dalgaard
P.Dalgaard at biostat.ku.dk
Fri Oct 10 16:24:38 CEST 2008
Göran Broström wrote:
> I want to make illustrations a la boxplot for a data material with
> several groups. Some of the groups are very small, so a boxplot
> doesn't make sense. I would like to use stripchart for these groups.
> On the other hand, some of the groups are very large, so for them
> stripchart isn't so good. So my question is: Is it possible to combine
> boxplots and and stripcharts in one figure? (Of course, in R anything
> is possible, but I mean in a simple way.) Or is there some other good
> alternative for a case like this?
>
Here's a first approximation.
library(ISwR)
l <- split(juul$igf1,juul$tanner)
sel <- sapply(l, length) > 100
boxplot(l[sel],horizontal=TRUE,at=(1:5)[sel], xlim=c(0,6))
stripchart(l[!sel],at=(1:5)[!sel], add=TRUE)
The y axis needs a bit more diddling.
In this case, I actually find that it is quite sufficint to do
stripchart(igf1 ~ tanner, data=juul, method="jitter", pch=19)
--
O__ ---- Peter Dalgaard Øster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help
mailing list