VOOZH about

URL: https://www.geeksforgeeks.org/r-language/create-a-plot-matrix-of-scatterplots-in-r-programming-pairs-function/

⇱ Create a Plot Matrix of Scatterplots in R Programming - pairs() Function - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Create a Plot Matrix of Scatterplots in R Programming - pairs() Function

Last Updated : 15 Jul, 2025

pairs() function in R language is used to return a plot matrix, consisting of scatter plots corresponding to each data frame.

R - Create Plot Matrix of Scatterplots

Syntax: pairs(data)

Parameters: 

  • data: It is defined as  value of pairs Plot.

Returns: Color, Labels, Panels, and by Group in pairs plot. 
 

Create Plot Matrix of Scatterplots in R

Example 1: Basic example of R - pairs() Function 

Output: 

👁 Image

Here, in the above example, the diagonal shows the names of the three numeric variables. The middle graphic in the first-row shows the relation between x1 and x2 whereas the right graph in the first row shows the relation between x1 and x3 and so on.

Example 2: Another example to select Variables of pairs Plot 

Output:

👁 Image

Example 3: Another example with implementation to Modify Color, Shape of Points, Labels and Title

Output:

👁 Image
Comment
Article Tags:

Explore