streamgraph is an htmlwidget for making, well, streamgraphs.

example

Sample Rmd

A streamgraph (or "stream graph") is a type of stacked area graph which is displaced around a central axis, resulting in a flowing, organic shape. Streamgraphs were developed by Lee Byron and popularized by their use in a February 2008 New York Times article on movie box office revenues. (Wikipedia)

The x axis values can be continous or dates.

TODO

The following functions are implemented:

News

Installation

devtools::install_github("hrbrmstr/streamgraph")
options(width=120)

Usage

library(streamgraph)

# current verison
packageVersion("streamgraph")

library(dplyr)

ggplot2movies::movies %>%
  select(year, Action, Animation, Comedy, Drama, Documentary, Romance, Short) %>%
  tidyr::gather(genre, value, -year) %>%
  group_by(year, genre) %>%
  tally(wt=value) -> dat

streamgraph(dat, "genre", "n", "year", interactive=TRUE) %>%
  sg_axis_x(20, "year", "%Y") %>%
  sg_fill_brewer("PuOr")

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.



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