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 = "Pearson\nCorrelation",
  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
)

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

Value

a ggplot2 object


Deleetdk/kirkegaard documentation built on Feb. 28, 2025, 5:04 p.m.