col_numeric_min_max: Customized version of scales::col_numeric with extra control...

Description Usage Arguments Details

Description

Customized version of scales::col_numeric with extra control of color ranges

Usage

1
2
3
4
5
col_numeric_min_max("heat", min.val=0, max.val=10)

col_numeric_min_max("heat", extend.min=0, extend.max=100)

col_numeric_min_max(c("pink","white","forestgreen"), symmetric=TRUE)

Arguments

palette

a valid palette name from 'RColorBrewer::brewer.pal.info', from 'viridis' ("viridis", "magma", "inferno", "plasma") or two or more colors for a color ramp

na.color

the color value to use for displaying NAs

alpha

the alpha (transparency) value to use, or FALSE

reverse

a logical. If TRUE, reverse the color direction

min.val, max.val

a double. 'NULL' or a minimum/maximum value at which to truncate the displayed data. Values above/below this value will all be displayed at the min/max color.

extend.min, extend.max

a double. 'NULL' or a minimum/maximum value to which the color range extends. This allows the color range to span outside of the data range.

symmetric

a logical. If TRUE, sets the color range to -/+ the absolute maximum value of the data. Such that the range spans equal lengths less than and greather than zero.

Details

This is a modified version of scales::col_numeric with extra arguments. 'min/max.val' allow you to "crush" the color range so that the min/max colors are pinned to these values rather than the true min/max of the data. 'extend.min/max' do the opposite and allow you to extend the color range outside of the data range. This is useful for placing the data range in a greater context than the data itself allows. 'symmetric' is useful for tri-color gradients (e.g. red/white/green) for representing negative/zero/positive values. It dynamically calculates 'extend.min/max' such that the minimum/maximum values for the color range are 'c(-1,+1) * max(abs(data))' If 'extend.min/max' are within the actual range of the data, they have no effect.


mkumar-rapttx/RAPTR documentation built on July 3, 2021, 10:14 p.m.