If I have hexidecimal color codes saved in my data frame, is there a scale_fill_manual() parameter that will utilize the color codes rather than treating them as strings (as my current code does)?
library(dplyr)
library(ggplot)
mtcars %>%
mutate(cyl = as.factor(cyl)) %>%
count(cyl) %>%
mutate(
fill =
case_when(
cyl == '4' ~ "#0177c9",
TRUE ~ "#54b709",
)
) %>%
ggplot(aes(x = cyl, y = n, fill = fill)) +
geom_col()