bi_scale_fill {biscale}R Documentation

Apply Bivariate Fill to ggplot Object

Description

Applies the selected palette as the fill aesthetic when geom_sf is used and the bi_class variable is given as the fill in the aesthetic mapping.

Usage

bi_scale_fill(pal, dim = 3, flip_axes = FALSE, rotate_pal = FALSE, ...)

Arguments

pal

A palette name or a vector containing a custom palette. See the help file for bi_pal for complete list of built-in palette names. If you are providing a custom palette, it must follow the formatting described in the 'Advanced Options' vignette.

dim

The dimensions of the palette, either 2 for a two-by-two palette, 3 for a three-by-three palette, or 4 for a four-by-four palette.

flip_axes

A logical scalar; if TRUE the axes of the palette will be flipped. If FALSE (default), the palette will be displayed on its original axes.

rotate_pal

A logical scalar; if TRUE the palette will be rotated 180 degrees. If FALSE (default), the palette will be displayed in its original orientation

...

Arguments to pass to scale_fill_manual

Value

A ggplot object with the given bivariate palette applied to the data.

See Also

bi_pal

Examples

# load dependencies
library(ggplot2)

# add breaks, 3x3
data <- bi_class(stl_race_income, x = pctWhite, y = medInc, style = "quantile", dim = 3)

# create map
plot <- ggplot() +
  geom_sf(data = data, aes(fill = bi_class), color = "white", size = 0.1, show.legend = FALSE) +
  bi_scale_fill(pal = "GrPink", dim = 3)


[Package biscale version 1.0.0 Index]