scale_identity: Scale identity

View source: R/scales.R

scale_identityR Documentation

Scale identity

Description

Creates an identity scale; a special case of a linear scale, where input is mapped to itself (input limits = output range). An identity scale is useful in cases where input data is already expressed in a visual representation (e.g. a line width) and should be used as-is.

Usage

scale_identity(col, na_value = 0, col_label = "{.col}", legend = TRUE)

Arguments

col

<name | string> The name of the column containing data to be scaled. Must be a valid input to rlang::ensym(); either a named column (non-standard evaluation), a string. Supports tidy-eval.

na_value

<number> The output value for NA input values.

col_label

<string | function> A template string or a label function for customising the column name in the legend.

  • if col_label is a string, {.col} may be used to represent the col name

  • if col_label is a function, the function must take a single argument: the col name

legend

<boolean> Indicate whether the legend should be displayed for this scale.

Note

Identity scales are almost equivalent to an accessor to a numeric column; differences are:

  • NA is replaced with na_value

  • May render a numeric legend

See Also

Other scales: rescale_center(), rescale_diverge(), scale_category(), scale_linear(), scale_log(), scale_power(), scale_quantile(), scale_quantize(), scale_symlog(), scale_threshold()


anthonynorth/rdeck documentation built on Aug. 11, 2024, 1:40 p.m.