[R] coplot with boxplot panel function
Sundar Dorai-Raj
sundar.dorai-raj at pdf.com
Tue Feb 18 15:22:03 CET 2003
Chuck Cleland wrote:
> I am attempting to construct a conditioning plot with a pair of
> boxplots within each panel. The resulting plot has panels misplaced.
> One misplaced panel is on top of the subcomponent describing ranges of
> the conditioning variable. This is what I did:
>
> X <- cut(rnorm(200), 2)
> Y <- runif(200)
> Z <- rnorm(200)
> given.Z <- co.intervals(Z, number = 4, overlap = .25)
>
> coplot(Y ~ X | Z, given.v = given.Z,
> panel = function(x, y, ...){boxplot(y ~ x)})
>
> Any suggestions as to why this does not work and what the correct
> specification is would be greatly appreciated.
>
Not sure, but you might want to try boxplot(y ~ x, add = TRUE).
When I did this I had to add xlim = c(0, 3) so the boxplots were drawn
completely within the panel.
Sundar
More information about the R-help
mailing list