Learn R Programming

kableExtra (version 1.4.0)

spec_color: Generate viridis or other color code for continuous values

Description

Generate viridis or other color code for continuous values

Usage

spec_color(
  x,
  alpha = 1,
  begin = 0,
  end = 1,
  direction = 1,
  option = "D",
  na_color = "#BBBBBB",
  scale_from = NULL,
  palette = viridisLite::viridis(256, alpha, begin, end, direction, option)
)

Arguments

x

continuous vectors of values

alpha

The alpha transparency, a number in [0,1],

begin

The (corrected) hue in [0,1] at which the color map begins.

end

The (corrected) hue in [0,1] at which the color map ends.

direction

Sets the order of colors in the scale. If 1, the default, colors are ordered from darkest to lightest. If -1, the order of colors is reversed.

option

A character string indicating the color map option to use. Eight options are available: "magma" (or "A"), "inferno" (or "B"), "plasma" (or "C"), "viridis" (or "D"), "cividis" (or "E"), "rocket" (or "F"), "mako" (or "G") and "turbo" (or "H").

na_color

color code for NA values

scale_from

input range (vector of length two). If not given, is calculated from the range of x

palette

The palette to use as a character vector of colors. If this is specified, parameters other than x, na_color and scale_from are ignored.