Skip to contents

Uses aes_type to know the color/fill, and color_type (from find_color_type()) to know what ggplot function to use to add the color. Needs to handle any color trans as well with transoutcome

Usage

handle_palettes(
  ggobj,
  aes_type,
  pal_list,
  color_type,
  transoutcome = "identity",
  setLimits = NULL,
  pal_direction = rep(1, length(pal_list)),
  base_list = NULL,
  nbins = 10
)

Arguments

ggobj

The in-construction ggplot object

aes_type

'color' or 'fill'

pal_list

list of palettes for defining colors for colorset. Should be length of colorgroups

color_type

from find_color_type()

transoutcome

transformation for outcome as in ggplot2::scale_y_continuous() or ggplot2::scale_fill_continuous(). Default transoutcome = 'identity' just uses the data. Most common change likely transoutcome = 'log10

setLimits

sets user-supplied color/fill limits or midpoints for maps, heatmaps, and networks, or y limits for other plots. Also sets underlay and overlay limits for consistency.

  • NULL (default) use internally-calculated limits

  • length-1 numeric, sets midpoint, limits stay auto-calculated. V. useful for divergent

  • length-2 numeric, sets lower and upper limits

  • length-3 numeric, sets limits and midpoint c(lower, mid, upper), with caveat that one limit may be ignored (must be symmetrical about the midpoint)

  • if base_list is 'difference' or 'relative', midpoints are auto-set at 0 or 1 (respectively) unless otherwise specified here.

pal_direction

vector of length pal_list, either 1 (default) or -1 (reversed) direction of the palettes

base_list

NULL (default) or named list of arguments to baseline_compare();

  • base_lev

  • comp_fun

  • group_cols plot_data_prep() handles zero_adjust, and other arguments are inferred or not supported If comp_fun is 'difference' or 'relative', midpoint auto-set at 0 or 1 respectively unless otherwise specified with setLimits

nbins

number of bins for contours

Value

modified ggplot object