Skip to content

Instantly share code, notes, and snippets.

@ljanda
Last active July 17, 2020 23:37
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save ljanda/4cbaeec1091849dc65cb7a7fe3a86965 to your computer and use it in GitHub Desktop.
Save ljanda/4cbaeec1091849dc65cb7a7fe3a86965 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