I want to change the order of the bar plot only for the last set, just to highlight it. I used scale_fill_manual()
, but it didn't help much.
Here's my code:
x<-c(rep(c("Type1", "Type2"),4))
y<-c(4,5,6,7,3,4,5,2)
time<-c(2010,2010,2011,2011,2012,2012,2013,2013)
z<-data.frame(type = x, val=y, Time = time)
ggplot(data = z, aes(x=Time,y=val)) +
geom_bar(stat = "identity", position = "dodge", aes(fill=type))+
scale_fill_manual(values = c(rep(c("white", "gray51"),3),"white","red"))
Here's the output:
I want the graph to look like:
Is there any way I can do this? I would appreciate any help. I looked at change color of only one bar in ggplot but it doesn't seem to be about grouped data.