回避策を使用して、ggplot の凡例から対角線を削除しています: https://groups.google.com/forum/?fromgroups=#!topic/ggplot2/vJnF9_HBqx4
次のデータで、グループの色を変更するにはどうすればよいですか?
# Create data #
a<-as.data.frame(c(1,1,1,2,2))
b<-as.data.frame(c("A","A","B","B","A"))
c<-as.data.frame(c(20,20,60,50,50))
a<-cbind(a,b,c)
colnames(a)<-c("X","Gp","Y")
# Plot #
ggplot(a, aes(x=X, y=Y,fill=Gp)) +
geom_bar(stat = "identity", aes(colour = "black")) +
scale_color_identity() +
theme(legend.key = element_rect(colour = "black", size = 1))
次の要素を変更しようとしました:
scale_color_identity(values=c("red","yellow"))
geom_bar(stat = "identity", aes(colour = c("red","yellow")))
geom_bar(stat = "identity", aes(colour = "black"), fill=c("red","yellow"))
しかし、それぞれエラーが発生します。