Intro Thoughts

Status Quo

library(tidyverse)

Experiment

library(ggplot2)
p1 <- ggplot() + 
  geom_point(data = mtcars,
             aes(mpg, mpg))

p2 <- ggplot() + 
  geom_point(aes(cty, hwy),
             data = mpg,
             color = "blue")


ggplot() + 
  p1$layers + 
  p2$layers + 
  coord_equal()

p1.2 <- ggplot(data = mtcars) + 
  geom_point(aes(mpg, mpg))

p1.3 <- ggplot(data = mtcars) + 
  geom_point(aes(x = 1, y = 1, color = NULL))


ggplot() + 
  p1.2$layers + 
  p2$layers + 
  coord_equal()
## Don't know how to automatically pick scale for object of type
## <tbl_df/tbl/data.frame>. Defaulting to continuous.
## Don't know how to automatically pick scale for object of type
## <tbl_df/tbl/data.frame>. Defaulting to continuous.
## Error in `data[[var]][scale_index[[i]]]`:
## ! Can't subset columns past the end.
## ℹ Locations 12, 13, 14, …, 233, and 234 don't exist.
## ℹ There are only 11 columns.
p1.2$layers$geom_point$data <- p1.2$data

ggplot() + 
  p1.2$layers

Closing remarks, Other Relevant Work, Caveats