powered by
Creates a publication-ready correlation heatmap for numeric variables in a data frame. Each tile shows the correlation coefficient, with optional significance stars.
plot_cor( data, method = "pearson", conf.level = 0.95, stars = TRUE, plot.title = NULL, var.labels = NULL )
A ggplot object showing the correlation heatmap with correlation coefficients and significance stars.
A data frame containing numeric variables to correlate.
Correlation method: "pearson", "spearman", or "kendall". Default is "pearson".
Confidence level for correlation confidence intervals. Default is 0.95.
Logical. If TRUE, adds significance stars based on p-values. Default is TRUE.
Character string specifying the plot title. If NULL, a default title is used.
Optional character vector of variable labels to replace column names in the plot. Must match number of numeric columns.
plot_cor(mtcars) plot_cor(mtcars, var.labels = colnames(mtcars)) plot_cor(mtcars, method = "spearman", stars = FALSE)
Run the code above in your browser using DataLab