Hi I have a double bar graph. I have searched for it, but I can't quite get what I want. Example of searches.
Reverse fill order of stacked bars with faceting
R - ggplot2 reverse order of bar
In ggplot2 for R, how do I reverse the order of the bar colors?
Unfortunately I dont have enough reputation to post an image :(
Here is my code:
dat9 <- data.frame(
Response = factor(c("Yes","Yes","Yes","Yes","Yes","No", "No", "No", "No", "No")),
Category = factor(c("Under 45","45-64","65+","Men","Women","Under 45", "45-64", "65+", "Men", "Women"), levels=c("Under 45","45-64","65+", "Men", "Women")),
percentage = c(79, 69, 44, 65, 72, 16, 22, 39, 25, 20))
ggplot(data=dat9, aes(x=Category, y=percentage, fill=Response,)) +
geom_bar(stat="identity", position=position_dodge(), colour="black")
(Not enough reputation to post PNG!)
I would like to reverse the red and blue bars in the image. Also reverse the blue and red box in the legend.
Updated (Added PNG)