Description Usage Arguments Value Examples
streamgraph()
initializes the streamgraph html widget
and takes a data frame in "long" format with columns for the
category (by default, it looks for key
) and its associated
date
and value
. You can supply the names for those
columns if they aren't named as such in your data.
By default, interactivity is on, but you can disable that by setting
the interactive
parameter to FALSE
.
1 2 3 4 5 |
data |
data frame |
key |
bare or quoted name of the category column (defaults to |
value |
bare or quoted name of the value column (defaults to |
date |
bare or quoted name of the date column (defaults to |
width |
Width in pixels (optional, defaults to automatic sizing) |
height |
Height in pixels (optional, defaults to automatic sizing) |
offset |
see d3's offset layout for more details.
The default is probably fine for most uses but can be one of |
interpolate |
see d3's area interpolation for more details.
The default is probably fine fore most uses, but can be one of |
interactive |
set to |
scale |
axis scale ( |
top |
top margin (default should be fine, this allows for fine-tuning plot space) |
right |
right margin (default should be fine, this allows for fine-tuning plot space) |
bottom |
bottom margin (default should be fine, this allows for fine-tuning plot space) |
left |
left margin (default should be fine, this allows for fine-tuning plot space) |
sort |
experimental |
complete |
experimental |
order |
streamgraph ribbon order. "'compat'" to match the orignial package behavior, "'asis'" to use the input order, "'inside-out'" to sort by index of maximum value, then use balanced weighting, or "'reverse'" to reverse the input layer order. |
streamgraph object
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ## 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")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.