View source: R/graphics_plot_correlation.R
| plot_correlation | R Documentation |
Correlation heatmap with optional labels and triangle filtering.
plot_correlation(
df,
vars = NULL,
method = c("pearson", "spearman", "kendall"),
use = "pairwise.complete.obs",
triangle = c("full", "upper", "lower"),
reorder = c("none", "hclust", "alphabetical"),
digits = 2,
label_size = 3,
tile_color = "white",
show_diag = TRUE,
title = NULL
)
df |
data.frame with numeric columns |
vars |
optional vector of column names to include |
method |
correlation method: "pearson", "spearman", or "kendall" |
use |
handling of missing values for |
triangle |
which triangle to show: "full", "upper", or "lower" |
reorder |
reordering strategy: "none", "hclust", or "alphabetical" |
digits |
number of digits for labels |
label_size |
size of label text |
tile_color |
border color for tiles |
show_diag |
whether to show the diagonal |
title |
optional plot title |
Computes a correlation matrix from numeric columns (or vars) and renders a ggplot2
heatmap with values annotated. Supports reordering by hierarchical clustering or alphabetically.
returns a ggplot2::ggplot graphic
data(iris)
grf <- plot_correlation(iris[,1:4])
plot(grf)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.