I am doing a boxplot in ggplot2, but I have been unable to find a way to deal with multiple colors across a 3 x 3 factor design.
This is an example code what I have able to do (using as a guide this thread):
library(ggplot2)
data <- data.frame(
value = sample(1:50),
animals = sample(c("cat","dog","zebra"), 50, replace = TRUE),
region = sample(c("forest","desert","tundra"), 50, replace = TRUE)
)
ggplot(data, aes(animals, value)) + geom_boxplot(aes(fill = animals)) +
facet_grid(~region) + scale_fill_brewer()
I am being able to use the color blue scale for the the categories: desert, forest and tundra. You can see the output here.
However, what I would like to use a diferent color scale for each one this categories. For example: yellow scale for dessert, green scale for forest and blue for tundra. Thanks!