rule_fill_gradient2: Fill column with sequential colour gradient

Description Usage Arguments Details Value See Also Examples

View source: R/rule_fill_gradient2.R

Description

Fills the background color of a column using a gradient based on the values given by an expression

Usage

1
2
3
4
5
rule_fill_gradient2(...)

rule_fill_gradient2_new(x, columns, expression, low = scales::muted("red"),
  mid = "white", high = scales::muted("blue"), midpoint = NA,
  space = "Lab", na.value = "#7F7F7F", limits = NA, lockcells = FALSE)

Arguments

...

Dots are used to transition from the old syntax rule_fill_discrete_old to the new one

x

A condformat object, typically created with 'condformat(x)'

columns

A character vector with column names to be coloured. Optionally 'tidyselect::select_helpers' can be used.

expression

an expression to be evaluated with the data. It should evaluate to a logical or an integer vector, that will be used to determine which cells are to be coloured.

low

colour for low end of gradient.

mid

colour for mid point

high

colour for high end of gradient.

midpoint

the value used for the middle color (the median by default)

space

colour space in which to calculate gradient. Must be "Lab" - other values are deprecated.

na.value

fill color for missing values

limits

range of limits that the gradient should cover

lockcells

logical value determining if no further rules should be applied to the affected cells.

Details

The syntax in condformat rules has changed since v0.7. See rule_fill_gradient_old

Value

The condformat_tbl object, with the added formatting information

See Also

Other rule: rule_css, rule_fill_discrete, rule_fill_gradient

Examples

1
2
3
4
5
6
7
8
data(iris)
condformat(iris[c(1:5, 70:75, 120:125), ]) %>%
 rule_fill_gradient2(Sepal.Length) %>%
 rule_fill_gradient2(Species, expression=Sepal.Length - Sepal.Width)

condformat(iris[c(1:5, 70:75, 120:125), ]) %>%
  rule_fill_gradient2("Petal.Length") %>%
  rule_fill_gradient2(starts_with("Sepal"), expression=Sepal.Length - Sepal.Width)

condformat documentation built on Nov. 17, 2017, 7:34 a.m.