make_legend_order: Make legend order depending on what the plot will contain.

View source: R/prepare_scales.R

make_legend_orderR Documentation

Make legend order depending on what the plot will contain.

Description

Make legend order depending on what the plot will contain.

Usage

make_legend_order(
  mode,
  col_scale = NULL,
  size_scale = NULL,
  annot_rows_df = NULL,
  annot_cols_df = NULL,
  bins = NULL,
  limits = NULL,
  high = NULL,
  mid = NULL,
  low = NULL,
  na_col = "grey50",
  midpoint = 0,
  size_range = NULL,
  legend_order = NULL
)

Arguments

mode

Plotting modes.

col_scale

One or two colour scales (shared for fill and colour). NULL for default, string for Brewer or Viridis, or a scale.

size_scale

Size scales (NULL or ggplot2 scales).

annot_rows_df

Annotation data frame for rows.

annot_cols_df

Annotation data frame for columns.

bins

Numeric for number of bins to determine if multiple scales are needed (if multiple bins values).

limits

Limits of scale (list of limits if two scales).

high

Colours at high values (correlation heatmap).

mid

Colours at medium values (correlation heatmap).

low

Colours at low values (correlation heatmap).

na_col

Colour if NA.

midpoint

Midpoint of divergent scale (correlation heatmap).

size_range

Size range (list of ranges if two scales).

legend_order

Numeric vector with legend order. NULL for default.

Value

A list with aesthetics for the main plot and orders of all legends.


ggcorrheatmap documentation built on Aug. 25, 2025, 1:11 a.m.