sg_fill_brewer: Use ColorBrewer palettes for streamgraph fill colors

Description Usage Arguments Value Examples

View source: R/color.r

Description

ColorBrewer provides sequential, diverging and qualitative colour schemes which are particularly suited and tested to display categorical values.

Usage

1
sg_fill_brewer(sg, palette = "Spectral")

Arguments

sg

streamgraph object

palette

ColorBrewer pallete atomic character value (defaults to Spectral)

Value

streamgraph object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not run: 
library(dplyr)
library(streamgraph)
ggplot2movies::movies %>%
select(year, Action, Animation, Comedy, Drama, Documentary, Romance, Short) %>%
  tidyr::gather(genre, value, -year) %>%
  group_by(year, genre) %>%
  tally(wt=value) %>%
  ungroup %>%
  mutate(year=as.Date(sprintf("%d-01-01", year))) -> dat

streamgraph(dat, "genre", "n", "year") %>%
  sg_fill_brewer("PuOr")

## End(Not run)

hrbrmstr/streamgraph documentation built on May 17, 2019, 5:14 p.m.