My data frame is as follows
School Gender Value ColorGroup
1 School1 Male 10 1Male
2 School1 Female 30 1Female
3 School2 Male 40 1Male
4 School2 Female 70 1Female
5 School3 Male 5 2Male
6 School3 Female 90 2Female
I can create the following bar charts
ggplot(data=data2, aes(x=School, y=Value, group = Gender, fill = Gender)) +
geom_bar(stat = "identity", position = position_dodge(), width = 0.5)
ggplot(data=data2, aes(x=School, y=Value, group = Gender, fill = ColorGroup)) +
geom_bar(stat = "identity", position = position_dodge(), width = 0.5)
What I wish to do is specify the colors as follows School3 to have different colors from School1 and School2 using the following code
cols33 <- c("1Male" = "yellow", "1Female" = "orange", "2Male" = "red", "2Female" = "blue")
ggplot(data=data2, aes(x=School, y=Value, group = Gender,fill = ColorGroup)) +
geom_bar(stat = "identity", position = position_dodge(), width = 0.5) +
scale_color_manual(name="",values=cols33)
but I still get the same output as barchart2.
Please can you help understand why the scale_color_manual is not being honored in my code.