**Edit:**I am sorry, but the situation could be a little bit more complex than I have shown. However, both of your scripts work, although the first might be not so clear for large dataset due to point overlap! Thanks very much Sacha!
I would like to first show the pairs of several variables, and then superimpose the selected data of the same dataset. Usually, the superimpose can be achived using par(new=T)
like this:
h<-rnorm(nc) # this variable was used for conditioning
x<-rnorm(nc)
y<-rnorm(nc)
z<-rnorm(nc)
m<-cbind(x,y,z)
pairs(m)
par(new=T)
pairs(m[h>0.7,],col="red")
However, it seems that the par()
setting does not work for such usage.
Then, probably lattice library could help, ex. splom()
, but I do not know if it really works, and how. Could someone give some suggestions?
I assume
paris
must bepairs
? Thepairs
function doesn't have anadd
argument or so, it would probably also not be that trivial since the plot has 9 panels (simply doingpoints
will plot in the last panel). but it is not that hard to do what you want in a single plot usingcol
:Edit:
Another thing you can do in
pairs
is actually set the function you want to do in each panel. By default this ispoints
, but you can extend that to include some conditions:This gives the same picture as before (well different points because I didnt set a seed). Simply making the color vector would be easier to accomplish this, but you can make the panel function as big as you would like.
Also, the
...
allow other arguments to be passed to thepoints
function: