colordiverger: Create diverging color palette

Description Usage Arguments Value Author(s) Examples

View source: R/colordiverger.R

Description

A function that takes two colors as its input and produces a color palette for plotting (z-scored) values (e.g. in a heatmap) with two diverging colors.

Usage

1
2
3
4
5
6
colordiverger(
  color1 = "mediumpurple",
  color2 = "tan",
  min.val = -5,
  max.val = 5
)

Arguments

color1

a color of R's predefined color names which is available in 4 graduations with names as follows (for the example of cyan): cyan1, cyan2, cyan3, cyan4; you may check availability online or within R with 'colors()'; color1 defines the color for all negative values; default: "mediumpurple"

color2

a color with the same demands as defined for color1; color2 defines the color for all positive values; default: "tan"

min.val

specifies the minimum value of the dataset the palette will be prepared for; the palette follows z-score graduations; default: -5

max.val

specifies the maximum value of the dataset the palette will be prepared for; default: 5

Value

customized diverging color palette

Author(s)

Paul Volkmann

Examples

1
my_color_palette <- colordiverger("springgreen", "steelblue")

volkmannp/ntbgraphics documentation built on March 3, 2020, 1:25 p.m.