In R, ggscatmat
is a scatter plot used for multivariate numerical data. It’s a part of the GGally
library. It creates scatter plots in the lower triangle, density line graphs in the diagonal, and correlations in the upper triangle.
The default implementation of ggscatmat
in R is as follows:
ggscatmat(data, columns = 1:ncol(data), color = NULL, alpha = 1,
corMethod = "pearson")
data
: This is the data matrix that will be used. It should contain a numeric data matrix.
columns
: This is an option to choose the columns from the data matrix. By default, it selects all the columns—1:ncol(data)
.
color
: This is an option to group the dataset by factor and color them differently. By default, the value is NULL
, meaning no coloring.
alpha
: This is an option to set transparency for larger datasets. By default, it is set to 1
.
corMethod
: This is a method passed as an argument to the cor
function.
library(GGally)data(flea)ggscatmat(flea, columns = 2:4, color="species", corMethod="pearson")
GGally
library to use the ggscatmat
function.flea
dataset from R.2
,3
,4
of the flea
matrix in our plot and the species
argument will give color to each column’s datapoints.