6

このトピックに関する別の質問を既に見ましたが、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"))

エラー: 離散スケールに連続値が指定されました!!! ああ!

***誰かがこれに緑のグラデーションを適用するのを手伝ってくれませんか?? ありがとう!!

4

2 に答える 2