sg_fill_manual: Use manual colors for streamgraph fill colors

Description Usage Arguments Value Examples

View source: R/color.r

Description

Specify a vector of colors (e.g. c("red", "#00ff00", rgb(0,0,1))) to use for the color scale. Note that streamgraph sorts the categorical values before assigning the mappings, which means you can use that as a determinstic way of assigning specific colors to categories. If the number of categories exceeds the number of colors in the palette, the colors will be reused in order.

Usage

1
sg_fill_manual(sg, values = NULL)

Arguments

sg

streamgraph object

values

character vector of

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_manual(c("black", "#ffa500", "blue", "white", "#00ff00", "red"))

## End(Not run)

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