My code is:
ggplot(my_data, aes(x = factor(inst), y = value, fill = color)) +
geom_boxplot(position = position_dodge(width = 0.75)) +
scale_fill_manual(values = c("blue" = "blue", "green" = "green", "red" = "red", "yellow" =
"yellow")) +
theme_bw()
And it shows a graph like this:
My grouping variable is color. How can I visualize the boxplots with different patterns inside,just black and white background, instead of colors.
Here's an example which should help you see how it is done:
Here's the output
{ggpattern}
has really good documentation, and an example of what you want can be found here: https://coolbutuseless.github.io/package/ggpattern/articles/geom-gallery-geometry.html#bw-example