Skip to contents

Creates a pairwise correlation matrix with scatter plots, correlation coefficients, and optional diagonal distributions.

Usage

CorPairsPlot(
  data,
  columns = NULL,
  group_by = NULL,
  group_by_sep = "_",
  diag_type = c("density", "histogram", "none"),
  cor_method = c("pearson", "spearman", "kendall"),
  cor_format = "{round(corr, 2)}",
  cor_size = 4,
  theme = "theme_ggforge",
  theme_args = list(),
  palette = ifelse(is.null(group_by), "Spectral", "forge"),
  palcolor = NULL,
  title = NULL,
  seed = 8525,
  ...
)

Arguments

data

Data frame

columns

Column names to include. If NULL, all numeric columns are used.

group_by

Optional grouping column for coloring points.

group_by_sep

Separator for concatenating multiple columns in group_by

diag_type

Diagonal plot type: "density", "histogram", or "none".

cor_method

Correlation method: "pearson", "spearman", or "kendall".

cor_format

Glue format string for correlation text. Variables: corr, pvalue.

cor_size

Font size for correlation text.

theme

Theme name or function.

theme_args

Additional theme arguments.

palette

Palette name.

palcolor

Custom colors.

title

Plot title.

seed

Random seed for reproducibility.

...

Additional arguments.

Value

A patchwork object

See also