Skip to content

Instantly share code, notes, and snippets.

@rcatlord
Created October 23, 2017 15:24
Show Gist options
  • Save rcatlord/4fd75107d6e91fd11eb7b22027fdac6b to your computer and use it in GitHub Desktop.
Save rcatlord/4fd75107d6e91fd11eb7b22027fdac6b to your computer and use it in GitHub Desktop.
source("https://trafforddatalab.github.io/assets/theme/ggplot2/theme_lab.R")
starwars %>%
mutate(name, bmi = mass / ((height / 100) ^ 2)) %>%
ggplot(aes(x = bmi)) +
geom_histogram(fill = "#fc6721", alpha = 0.8, binwidth = 10) +
scale_x_continuous(expand = c(0, 0), limits=c(0, 450)) +
labs(x = "Body Mass Index [kg/m^2]", y = NULL,
title = "BMI distribution for Star Wars characters") +
theme_lab()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment