sg_axis_x: Modify streamgraph x axis formatting

Description Usage Arguments Value Examples

View source: R/sg_axis_x.r

Description

Change the tick interval, units and label text display format for the streamgraph x axis.

Usage

1
2
sg_axis_x(sg, tick_interval = NULL, tick_units = NULL,
  tick_format = NULL)

Arguments

sg

streamgraph object

tick_interval

tick interval

tick_units

units for the ticks

tick_format

how to show the labels (subset of strftime formatters for date scale, otherwise sprintf formats for continuous scale) (defaults to %b - must specify if continuous). See https://github.com/mbostock/d3/wiki/Formatting for more details.

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_axis_x(20, "year", "%Y")

## End(Not run)

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