### Dummy code to use specific colors in parts of your plot## Create color column in data setpenguins_dat <- palmerpenguins::penguins |>filter(!is.na(sex)) |>mutate(colors =if_else( bill_length_mm >median(bill_length_mm),'#CC79A7','grey80' ) )## Map new column to color or fill and use scale_*_identity()penguins_dat |>ggplot(aes(bill_length_mm, flipper_length_mm, fill = colors)) +geom_point(shape =21, size =4, stroke =0.5, col ='grey20') +scale_fill_identity() +theme_minimal(base_size =16)
Enjoyed this code snippet?
You may also like my weekly 3-minute newsletter. Reading time: 3 minutes or less.
Or you can check out previous editions of the newsletter at 3mw.albert-rapp.de