https://www.r-bloggers.com/ggplot2-cheatsheet-for-barplots/
#########Plotting a different variable on y axis instead of count as usual in bar plots
ggplot(mtc,aes(x=factor(gear), y=wt)) + stat_summary(fun.y=mean, geom="bar")
ggplot(data=diamonds,aes(x=clarity,y=price)) + geom_bar(stat="identity")
#replacing stat count with stat identity while plotting
##This will plot mean of wt with gear
Add color to the bar
ggplot(mtc,aes(x=factor(gear), y=wt,fill=factor(gear))) + stat_summary(fun.y=mean, geom="bar")+ scale_fill_manual(values=c("purple", "blue", "darkgreen"))