
Last chance! 50% off unlimited learning
Sale ends in
Creates a matrix of scatterplots, one for each possible pair of variables.
PairPlot(
d,
meas_vars,
title,
...,
group_var = NULL,
alpha = 1,
palette = "Dark2",
point_color = "darkgray"
)
a ggplot2 pair plot
data frame
the variables to be plotted
plot title
not used, forces later arguments to bind by name
variable for grouping and colorcoding
alpha for points on plot
name of a brewer palette (NULL for ggplot2 default coloring)
point color for monochrome plots (no grouping)
If palette
is NULL, and group_var
is non-NULL, plot colors will be chosen from the default ggplot2 palette.
Setting palette
to NULL
allows the user to choose a non-Brewer palette, for example with scale_color_manual
.
# PairPlot(iris, colnames(iris)[1:4], "Example plot", group_var = "Species")
# custom palette
colormap = c('#a6611a', '#dfc27d', '#018571')
PairPlot(iris, colnames(iris)[1:4], "Example plot",
group_var = "Species", palette=NULL) +
ggplot2::scale_color_manual(values=colormap)
# # no color-coding
# PairPlot(iris, colnames(iris)[1:4], "Example plot")
Run the code above in your browser using DataLab