% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/geoms-base.R
\name{geom_cor}
\alias{geom_cor}
\title{Correlation matrix heatmap}
\usage{
geom_cor(
  data,
  vars = NULL,
  label = TRUE,
  label_size = NULL,
  low = "#C1462F",
  mid = "#F2F0EA",
  high = "#12A594"
)
}
\arguments{
\item{data}{A data frame; correlations are computed over its numeric
columns.}

\item{vars}{Character vector of numeric columns to include; default all
numeric columns in \code{data}.}

\item{label}{Annotate each cell with its correlation coefficient.}

\item{label_size}{Annotation text size in px.}

\item{low, mid, high}{Diverging fill colors for correlation -1, 0, +1.}
}
\value{
A \link{Layer} to add with \code{+}.
}
\description{
All pairwise Pearson correlations among the numeric columns of \code{data},
shaded on a diverging scale (negative to positive) and annotated with
the coefficient. Takes the raw wide data frame directly rather than
through \code{aes()}, since the stat needs the whole numeric block at once
to compute pairwise correlations, not row-wise aesthetic vectors — the
same pattern \code{\link[=geom_dendrogram]{geom_dendrogram()}} uses.
}
\examples{
ggnext() +
  geom_cor(mtcars, vars = c("mpg", "cyl", "disp", "hp", "wt")) +
  labs(title = "Correlation matrix")
}
