Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3983338
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T05:38:09+00:00 2026-05-20T05:38:09+00:00

**Edit:**I am sorry, but the situation could be a little bit more complex than

  • 0

**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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T05:38:10+00:00Added an answer on May 20, 2026 at 5:38 am

    I assume paris must be pairs? The pairs function doesn’t have an add argument or so, it would probably also not be that trivial since the plot has 9 panels (simply doing points will plot in the last panel). but it is not that hard to do what you want in a single plot using col:

    nc <- 100
    set.seed(1)
    x<-rnorm(nc)
    y<-rnorm(nc)
    z<-rnorm(nc)
    m<-cbind(x,y,z)
    
    cols <- ifelse(x>0.7,"red","black")
    pairs(m,col=cols)
    

    enter image description here

    Edit:

    Another thing you can do in pairs is actually set the function you want to do in each panel. By default this is points, but you can extend that to include some conditions:

    nc <- 100
    
    X<-rnorm(nc)
    Y<-rnorm(nc)
    Z<-rnorm(nc)
    m<-cbind(X,Y,Z)
    
    panelfun <- function(x,y,foo=X,...){
        points(x[foo<0.7],y[foo<0.7],col="black",...)
        points(x[foo>0.7],y[foo>0.7],col="red",...)
    }
    
    pairs(m,panel=panelfun)
    

    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 the points function:

    pairs(m,panel=panelfun,pch=16)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDIT Sorry I forgot the most important part here. Each key can have more
Sorry for bumpy topic name (feel free to edit if you find more fitting
I have a situation where I send jquery ajax post request but in my
Lots of words below, sorry - but I wanted to explain this situation well:
Edit: Sorry guys, but I wasn't seeing this behavior when I came into work
IMPORTANT EDIT: Sorry everyone, i made a big mistake in the structure. char *name;
EDIT: It does work (sorry). Something in this script is causing it to stop
Edit: I fixed the problem by just starting from scratch. Sorry to waste y'alls
Edit: When I say SQL Server, I'm really talking about the Management Studio. Sorry
Sorry if this question will sound too chaotic, feel free to edit it. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.