Skip to content

Instantly share code, notes, and snippets.

@rcatlord
Last active October 23, 2017 15:23
Show Gist options
  • Save rcatlord/44e781f14540e2c182904aca87eddc97 to your computer and use it in GitHub Desktop.
Save rcatlord/44e781f14540e2c182904aca87eddc97 to your computer and use it in GitHub Desktop.
theme_demo <- function () {
theme_grey() %+replace%
theme(panel.background = element_blank(),
axis.ticks = element_blank(),
panel.grid.minor = element_blank(),
panel.grid.major.x = element_blank(),
panel.grid.major.y = element_line(colour = "#757575", size = 0.3),
plot.title = element_text(colour = "#2c7fb8", size = 14, face = "bold", h = 0),
axis.title = element_text(colour = "#212121", size = 10))
}
starwars %>%
mutate(name, bmi = mass / ((height / 100) ^ 2)) %>%
ggplot(aes(x = bmi)) +
geom_histogram(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_demo()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment