0

My factor has 2 levels: A and B

data_set %>% 
    ggplot(aes(x = effort, y = rating, fill = factorAB)) + 
    geom_bar(position = "dodge", stat = "summary", fun.y = "mean") + 
    scale_fill_manual(name = "factorAB", values=c("darkgoldenrod2", "chartreuse4")) 

So I have 2 conditions on my X axis (2 effort conditions, effort 1 and effort 2), and I also have 2 factors (A and B). Scale_fill_manual function assigns color to each factor, 1 color for A and 1 color for B, but I want to assign 4 different colors (so effort 1 A is different from effort 2 A).

How can I do this? Thank you.

1 Answers1

2

Change fill to an interaction!

 ggplot(aes(x = effort, y = rating, fill = interaction(factorAB,effort)))
+ ...