Skip to content

Instantly share code, notes, and snippets.

@scbrown86
Forked from ljanda/facet_labels_bottom.R
Created September 26, 2019 01:49
Show Gist options
  • Save scbrown86/b2aaaf2ea5cfed55d13849d10636db37 to your computer and use it in GitHub Desktop.
Save scbrown86/b2aaaf2ea5cfed55d13849d10636db37 to your computer and use it in GitHub Desktop.
library(tidyverse)
library(scales)
data(diamonds)
diamonds %>%
filter(str_detect(cut, "Fair|Ideal")) %>%
ggplot(aes(price, carat)) +
geom_point(color = "skyblue", alpha = 0.5) +
facet_wrap(~cut, strip.position = "bottom") +
scale_x_continuous(labels = comma) +
labs(x = "Price", y = "Carat",
title = "Diamond Carat and Price for Worst and Best Cut",
subtitle = "Fair cut has fewer data points, more variation than ideal cut") +
theme_minimal() +
theme(strip.background = element_blank(),
strip.placement = "outside")
## https://github.com/tidyverse/ggplot2/issues/2622
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment