我已经看到了关于这个主题的另一个问题,但我仍然无法在ggplot中的分组条形图上更改我的颜色.它给我提供了一个蓝色的比例,但我想要一个绿色的规模.我是ggplot的新手,可能会遗漏一些明显的东西.
这是我的一些代码:
TCplot=ggplot(mTCdf,aes(x=types4,y=TCs,group=years3,color=years3))
+geom_bar(aes(fill=years3),stat="identity",position="dodge",color="black")
mTCdf$types4=factor(mTCdf$types4,levels=c("Single Year Lease","Multi-Year Lease","Permanent"))
levels(mTCdf$types4) ###just to get my labels in my desired order
TCplot=TCplot+ggtitle("Total Costs by Transaction_Type")
+theme(plot.title=element_text(lineheight=.7,face="bold"))
+xlab("Transaction Type")
+ylab("Costs ($)")
library(scales)
TCplot=TCplot+scale_y_continuous(labels=comma)
TCplot=TCplot+scale_fill_manual(values=c("#66FF22","#33FF22","#33EE22","#33DD22","#33CC22","#33BB22","#33AA22","#339922","#338822","#337722","#336622"))
TCplot=TCplot+scale_fill_manual(values=c("#66FF22","#33FF22","#33EE22","#33DD22","#33CC22","#33BB22","#33AA22","#339922","#338822","#337722","#336622"))
Run Code Online (Sandbox Code Playgroud)
错误:提供给离散秤的连续值!哎呀!
***有人可以帮我申请绿色渐变吗?谢谢!!