Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlbertRapp/3c2a18191fcd9c2ea08006bede8aac52 to your computer and use it in GitHub Desktop.
Save AlbertRapp/3c2a18191fcd9c2ea08006bede8aac52 to your computer and use it in GitHub Desktop.
vars-reprex
library(tidyverse)
dat <- mpg %>%
mutate(
custom_color = if_else(
year == 2008 & manufacturer == 'audi',
'dodgerblue4',
'grey80'
)
)
dat %>%
ggplot(aes(cty, hwy)) +
geom_jitter(col = vars(custom_color), size = 2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment