0
我有一個六人表現的數據集。我想顯示「最低」和「目標」表現 - 在這個例子中,分別是100和140。添加軸勾號標籤到堆積條形圖
require("ggplot2")
stones<-c("Mick","Keith","Brian","Bill","Charlie","Ronnie")
rMat<-data.frame(c(rep(100,6),rep(40,6),20,21,27,46,138,168),
c(rep(1:6,3)),c(rep(stones,3)))
colnames(rMat)<-c("X1","X2","X3")
colors <- c("white","#F2F2F2","#E5E5FF", "white","#F2F2F2","#CCCCFF", "white","#F2F2F2","#B2B2FF","white","#F2F2F2", "#9999FF", "white","#F2F2F2","#7F7FFF","white","#F2F2F2","#6666FF")
gp<-ggplot(NULL,aes(X2,X1),label=rROC[,1])+theme_bw()
gp<-gp+geom_bar(data=rMat,stat="identity",fill=colors,colour="gray")
gp<-gp+coord_flip()
gp<-gp+ylab("Performance")+xlab("")
gp<-gp+scale_x_discrete(labels=rMat[,3])
gp
我的數據拆分成三行每人(爲0至最低,最低到目標,然後將剩餘部分。
有多於六個y軸刻度標記,並。其結果是,名稱不匹配(例如,羅尼具有最高的性能,而不是米克)
我以前有每人一行(有工作標籤),像這樣:
perf<-c(160,161,167,186,278,308)
stones<-c("Mick","Keith","Brian","Bill","Charlie","Ronnie")
rMat<-data.frame(perf,c(1:6),stones)
但是,我無法像上面的例子那樣分割條。請任何人都可以建議如何讓標籤和分割條工作?
謝謝