Skip to content

Instantly share code, notes, and snippets.

@rcatlord
Created October 23, 2017 15:16
Show Gist options
  • Save rcatlord/641493e4c32a5e946ca4a8f77879948c to your computer and use it in GitHub Desktop.
Save rcatlord/641493e4c32a5e946ca4a8f77879948c to your computer and use it in GitHub Desktop.
library(tidyverse)
plot <- 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")
plot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment