I have a stacked bar chart and, inspired by Figure 3.8 on this page, I would like to highlight one bar of the bar chart. For example, I'd like all three colours for middle bar to be a notch darker and all the colours in the 1st and 3rd bars to be a little lighter. I'm assuming that the darken
argument to scale_fill_OkabeIto
could come in handy in some way.
library(ggplot)
library(colorblindr)
ID <- rep(1:3, each = 3)
group <- rep(letters[1:3], times = 3)
prop <- c(0.8, 0.1, 0.1, 0.6, 0.3, 0.1, 0.4, 0.3, 0.3)
toy_df <- data.frame(ID = ID, group = group, prop = prop)
ggplot(toy_df, aes(x = ID, y = prop, fill = group)) +
geom_bar(stat = "identity") +
scale_fill_OkabeIto()
Below is the graph so far:
I have seen posts showing how to do this for regular bar charts but can't figure out how to do this for a stacked bar chart.
Thanks for your help.