[R] multiple car scatterplots on one graph

David Winsemius dwinsemius at comcast.net
Fri Oct 15 05:29:13 CEST 2010


This is a duplicate, right? You're not posting again after what Greg  
Snow already explained what needed to be done, are you?

-- 
David.
On Oct 14, 2010, at 11:20 PM, Christopher W Ryan wrote:

> R version 2.11.1 on WinXP
>
> How do I get 3 scatterplots with marginal boxplots (from the
> car package) onto a single plot?
>
> I have a data frame called bank
>
>> dim(bank)
> [1] 46  5
>
> head(bank)
>
>     x1    x2   x3   x4 pop
> 1 -0.45 -0.41 1.09 0.45   0
> 2 -0.56 -0.31 1.51 0.16   0
> 3  0.06  0.02 1.01 0.40   0
> 4 -0.07 -0.09 1.45 0.26   0
> 5 -0.10 -0.09 1.56 0.67   0
> 6 -0.14 -0.07 0.71 0.28   0
>
> library(car)
> par(mfrow=c(2,2))
>
> # following lines may be wrapped badly--sorry
>
> with(bank, scatterplot(x1,x2,groups=pop, reg.line=FALSE,
> smooth=FALSE, boxplots="xy", reset.par=FALSE))
>
> with(bank, scatterplot(x1,x3,groups=pop, reg.line=FALSE,
> smooth=FALSE, boxplots="xy", reset.par=FALSE))
>
> with(bank, scatterplot(x1,x4,groups=pop, reg.line=FALSE,
> smooth=FALSE, boxplots="xy", reset.par=FALSE))
>
> I have tried various permutations of the reset.par=  option:
> all three lines FALSE, all 3 lines TRUE, the first TRUE and
> the others FALSE, vice versa, etc. And always I get just one
> scatterplot showing up on the device at a time, and
> occupying the whole thing.
>
> Thanks.
>
> --Chris Ryan
> SUNY Upstate Medical University
> Binghamton Clinical Campus
>
> 	[[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.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list