Created
May 26, 2022 19:34
-
-
Save AlbertRapp/3c2a18191fcd9c2ea08006bede8aac52 to your computer and use it in GitHub Desktop.
vars-reprex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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