sp_manual_fill_ggplot2: Add manual fill-color assignment for both categorical and...

Description Usage Arguments Value Examples

Description

Add manual fill-color assignment for both categorical and numerical variable

Usage

1
2
3
4
5
6
7
sp_manual_fill_ggplot2(
  p,
  data,
  color_variable,
  manual_color_vector = NULL,
  alpha = 1
)

Arguments

p

A ggplot2 object

data

Data matrix used for the ggplot2 object p

color_variable

Name of columns for color assignment

manual_color_vector

Manually set colors for each geom. Default NULL, meaning using ggplot2 default. Colors like c('red', 'blue', '#6181BD') (number of colors not matter) or a RColorBrewer color set like "BrBG" "PiYG" "PRGn" "PuOr" "RdBu" "RdGy" "RdYlBu" "RdYlGn" "Spectral" "Accent" "Dark2" "Paired" "Pastel1" "Pastel2" "Set1" "Set2" "Set3" "Blues" "BuGn" "BuPu" "GnBu" "Greens" "Greys" "Oranges" "OrRd" "PuBu" "PuBuGn" "PuRd" "Purples" "RdPu" "Reds" "YlGn" "YlGnBu" "YlOrBr" "YlOrRd" (check http://www.sthda.com/english/wiki/colors-in-r for more).

alpha

Transparency

Value

A ggplot2 object

Examples

1
2
3
4
## Not run:
p <- sp_manual_fill_ggplot2(p, data, color_variable, manual_color_vector)

## End(Not run)

Tong-Chen/YSX documentation built on Jan. 25, 2021, 2:49 a.m.