Skip to content

Instantly share code, notes, and snippets.

@alexhallam
Created September 12, 2018 03:35
Show Gist options
  • Save alexhallam/5bfbb03ecf80f89706568487bb695b9b to your computer and use it in GitHub Desktop.
Save alexhallam/5bfbb03ecf80f89706568487bb695b9b to your computer and use it in GitHub Desktop.
library(tidyverse)
library(gumballthemes)
dat <- read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2018-09-11/cats_vs_dogs.csv")
dat <- dat %>%
mutate(household_label = ifelse(n_dog_households > n_cat_households, "more dog households", "more cat households"))
p <- ggplot(dat, aes(x = percent_cat_owners, y = percent_dog_owners, color = household_label)) +
geom_point() +
ylab("% Dog Owners") +
xlab("% Cat Owners") +
annotate("text", y = 20, x = 17,
label = c("Catastrophic Clustering")) +
gumballthemes::geom_quantileframe() +
scale_y_quantile(dat$percent_dog_owners) +
scale_x_quantile(dat$percent_cat_owners) +
scale_color_gumball() +
theme_gumball()
p %>% ggsave(filename = "meaningless.jpg", height = 5, width = 8.1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment