r slugger_graphic1.R

Posted

tags:

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

#reorder the factor level in order so we can cleanly see the RBIs and their varibility among these sluggers
hrs$nameyear <- factor(hrs$nameyear, levels=hrs[order(hrs$RBI), "nameyear"])
#create a flipped bar plot and gradient fill the bars with the corresponding HRs
ggplot(data=hrs, aes(x=nameyear, y=RBI, fill=HR)) + geom_bar(stat="identity") +
  coord_flip() + scale_fill_gradient(low="gray50", high="red")

以上是关于r slugger_graphic1.R的主要内容,如果未能解决你的问题,请参考以下文章