Description Usage Arguments Value Examples
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.
1 | sg_fill_manual(sg, values = NULL)
|
sg |
streamgraph object |
values |
character vector of |
streamgraph object
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.