GG_heatmap: Heatmap correlation matrix with ggplot2

View source: R/plotting.R

GG_heatmapR Documentation

Heatmap correlation matrix with ggplot2

Description

Heatmap correlation matrix with ggplot2

Usage

GG_heatmap(
  data,
  add_values = T,
  reorder_vars = T,
  digits = 2,
  font_size = 4,
  color_label = "Correlation",
  legend_position = c(0.4, 0.7),
  short_x_labels = F,
  axis_labels_clean_func = str_clean,
  dodge_x_labels = 1,
  min_n = 0,
  pairwise_n = NULL,
  pairwise_p = NULL,
  cross_out_nonsig = F,
  p_sig = 0.01,
  remove_diag = F
)

Arguments

data

Data frame or a matrix

add_values

Whether to add the correlation sizes as text to plot

reorder_vars

Whether to reorder variables so strongly related ones are close to each other

digits

How many digits to print when plotting them

font_size

If correlation values are plotted, their size

color_label

Which label to use for the color scale legend

legend_position

Position of the legend. Sometimes you may need to move it a bit

short_x_labels

Adds integers to the y axis labels, and replaces the x labels with the same integers. Useful when there are many variables.

axis_labels_clean_func

A function to clean the labels with, typically to remove underscores. NULL means disable.

dodge_x_labels

How much to dodge the x labels. Useful when there are many variables.

min_n

Minimum number of observations to include a correlation

pairwise_n

Pairwise number of observations. If not given, it is computed from the data.

pairwise_p

Pairwise p-values. If not given, it is computed from the data unless data is a matrix.

cross_out_nonsig

Cross out non-significant correlations

p_sig

Significance level for cross out

remove_diag

Remove diagonal values

Value

a ggplot2 object


Deleetdk/kirkegaard documentation built on June 8, 2025, 4:09 a.m.