Scatterplot Matrices

When we have two or more variables and we want to correlate between one variable and others so we use a R scatterplot matrix.

pairs() function is used to createR  matrices of scatterplots.

Syntax: pairs(formula, data)

Parameters: 

  • formula: This parameter represents the series of variables used in pairs.
  • data: This parameter represents the data set from which the variables will be taken.

Example: 

R




# Plot the matrices between
# 4 variables giving 12 plots.
 
# One variable with 3 others
# and total 4 variables.
pairs(~wt + mpg + disp + cyl, data = mtcars,
    main = "Scatterplot Matrix")


Output: 

Scatter plots in R Language

Scatter plots in R Language

A scatter plot is a set of dotted points representing individual data pieces on the horizontal and vertical axis. In a graph in which the values of two variables are plotted along the X-axis and Y-axis, the pattern of the resulting points reveals a correlation between them.

Similar Reads

R – Scatter plots

We can create a scatter plot in R Programming Language using the plot() function....

Simple Scatterplot Chart

In order to create Scatterplot Chart:...

Creating a Scatterplot Graph

...

Scatterplot Matrices

In order to create an R Scatterplot graph:...

Scatterplot with fitted values

...

Adding title with dynamic name

When we have two or more variables and we want to correlate between one variable and others so we use a R scatterplot matrix....

3D Scatterplots

...