0

I am making a bar chart with ggplot and using facet for showing the details. I am using the following code.

g1 <- ggplot(mydata, aes(x=PF.Score))+
  geom_bar(color="Black", fill="skyblue")+
  geom_text(stat="count", aes(label=..count..), size =4, vjust=-0.3)+
  ylab("% of Suppliers")+
  xlab("Score of Suppliers")+
  ggtitle("Score distribution of suppliers")+
  theme_classic()+
  theme(axis.ticks.y= element_blank(),axis.text.y = element_blank())

  g2 <- g1+facet_wrap(~GROUP)
  g1+g2

and I am getting the following output

Result Ouptput

However i require each bar with different color, e.g bar of "2" to be of "red", "3" to be of "blue" & so on & same colors in the facet Graph also. but i am not able to get such colors in the bar-chart. Also the colors will be used as legends.

Any Help is highly appreciated.

0 Answers0