Skip to content

Instantly share code, notes, and snippets.

@expersso
Created February 15, 2016 09:55
Show Gist options
  • Save expersso/f8e2ba5f242fa43443e0 to your computer and use it in GitHub Desktop.
Save expersso/f8e2ba5f242fa43443e0 to your computer and use it in GitHub Desktop.
Minimal Anscombe
library(dplyr)
library(tidyr)
library(ggplot2)
df <- anscombe %>%
gather() %>%
mutate(axis = substr(key, 1, 1)) %>%
mutate(number = substr(key, 2, 2)) %>%
group_by(axis, number) %>%
mutate(key = 1:n()) %>%
spread(axis, value)
ggplot(df, aes(x, y)) +
geom_point(size = 7) +
geom_abline(intercept = 3, slope = 0.5) +
facet_wrap(~number) +
theme_void() +
xlim(c(4, 20)) +
ylim(c(3, 13)) %>%
ggsave("shirt.svg", ., "svg")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment