r 酒吧情节

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了r 酒吧情节相关的知识,希望对你有一定的参考价值。

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"))

以上是关于r 酒吧情节的主要内容,如果未能解决你的问题,请参考以下文章