Intro Thoughts

Status Quo

library(tidyverse)

Experiment

GeomBoxplot$default_aes
## Aesthetic mapping: 
## * `weight`    -> 1
## * `colour`    -> `from_theme(col_mix(ink, paper, 0.2))`
## * `fill`      -> `from_theme(paper)`
## * `size`      -> `from_theme(pointsize)`
## * `alpha`     -> NA
## * `shape`     -> `from_theme(pointshape)`
## * `linetype`  -> `from_theme(bordertype)`
## * `linewidth` -> `from_theme(borderwidth)`
## * `width`     -> 0.9
GeomBin2d$default_aes
## Aesthetic mapping: 
## * `fill`      -> `from_theme(col_mix(ink, paper, 0.2))`
## * `colour`    -> NA
## * `linewidth` -> `from_theme(0.4 * borderwidth)`
## * `linetype`  -> `from_theme(bordertype)`
## * `alpha`     -> NA
## * `width`     -> 1
## * `height`    -> 1
library(ggalluvial)
GeomStratum$default_aes
## Aesthetic mapping: 
## * `size`      -> 0.5
## * `linewidth` -> 0.5
## * `linetype`  -> 1
## * `colour`    -> "black"
## * `fill`      -> "white"
## * `alpha`     -> 1
GeomRect$default_aes
## Aesthetic mapping: 
## * `colour`    -> NA
## * `fill`      -> `from_theme(col_mix(ink, paper, 0.35))`
## * `linewidth` -> `from_theme(borderwidth)`
## * `linetype`  -> `from_theme(bordertype)`
## * `alpha`     -> NA
GeomStratum$default_aes <- modifyList(GeomRect$default_aes, aes(color = from_theme(ink),
                                                                fill = from_theme(paper)))

Titanic %>% 
  data.frame() %>%  
  ggplot() + 
  aes(axis1 = Sex, axis2 = Age, y = Freq) +
  geom_alluvium() +
  geom_stratum() 

GeomStratum$default_aes <- modifyList(GeomRect$default_aes, 
                                      aes(color = from_theme(ink),
                                          fill = from_theme(paper)))

last_plot() 

GeomStratum$default_aes <- GeomBoxplot$default_aes

last_plot() 

last_plot() + 
  ggchalkboard::theme_chalkboard()

library(ggsankey)
df <- mtcars %>%
  make_long(cyl, vs, am, gear, carb)

ggplot(df, aes(x = x, 
               next_x = next_x, 
               node = node, 
               next_node = next_node,
               fill = factor(node))) +
  geom_sankey() +
  scale_fill_discrete(drop=FALSE)

last_plot() + 
  ggchalkboard::theme_chalkboard()

ggplot(df, aes(x = x, next_x = next_x, node = node, next_node = next_node, fill = factor(node), label = node)) +
  geom_sankey(flow.alpha = .6,
              node.color = "gray30") +
  geom_sankey_label(aes(fill = NULL)) +
  scale_fill_viridis_d(drop = FALSE) +
  theme_sankey(base_size = 18) +
  labs(x = NULL) +
  theme(legend.position = "none",
        plot.title = element_text(hjust = .5)) +
  ggtitle("Car features")

last_plot() + 
  ggchalkboard:::theme_chalkboard()

geom_sankey_label
## function (mapping = NULL, data = NULL, position = "identity", 
##     na.rm = FALSE, show.legend = NA, space = NULL, type = "sankey", 
##     width = 0.1, inherit.aes = TRUE, ...) 
## {
##     label.aes <- list(...)
##     list(label = ggplot2::layer(stat = StatSankeyText, data = data, 
##         mapping = mapping, geom = "label", position = position, 
##         show.legend = show.legend, inherit.aes = inherit.aes, 
##         params = purrr::flatten(list(na.rm = na.rm, width = width, 
##             space = space, type = type, label.aes))))
## }
## <bytecode: 0x7ff31acc4400>
## <environment: namespace:ggsankey>

Closing remarks, Other Relevant Work, Caveats