library(ggplot2)
scale_fill_msf <- function(...) {
ggplot2:::manual_scale(
"fill",
values = c(
"MSF" = "#D02327",
"OCA" = "#EF5423",
"OCB" = "#FFC70A",
"OCBA" = "#0D9948",
"OCG" = "#CB1C66",
"OCP" = "#34469C",
"WaCA" = "#007E92"
),
...
)
}
ocs <- c("MSF", "OCA", "OCB", "OCBA", "OCG", "OCP", "WaCA")
df <- data.frame(
oc = ocs,
value = runif(length(ocs), 5, 10)
)
ggplot(df, aes(x = oc, y = value, fill = oc)) +
geom_col() +
scale_fill_msf()
Created on 2023-02-16 with reprex v2.0.2