Skip to content

Instantly share code, notes, and snippets.

@MCMaurer
Created October 18, 2022 16:41
Show Gist options
  • Save MCMaurer/c75e6069bd516865b63c407ccecdd65e to your computer and use it in GitHub Desktop.
Save MCMaurer/c75e6069bd516865b63c407ccecdd65e to your computer and use it in GitHub Desktop.
How to grab colors to use in ggplot
library(tidyverse)
mtcars %>%
ggplot(aes(x = wt, y = mpg, color = factor(cyl))) +
geom_point() +
scale_color_manual(values = c("red", "blue", "#80DBCA"))
# open Digital Color Meter on Mac, find the color you want, and get the RGB values from that application
# then put those colors in here, and use the resulting hex code in scale_color_manual
rgb(red = 128, green = 219, blue = 202, maxColorValue = 255)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment