我很抱歉無信息標題。ggplot geom_bar - 酒吧太寬
> y=read.csv(textConnection(scan("",sep="\n",what="raw")))
"","org","art","type","length"
"191","gk","Finish","short",4
"147","ik","Attending","short",7
"175","gl","Finish","long",11
"192","il","Attending","long",95
"144","gm","Finish","between",5
"161","im","Attending","between",15
"164","tu","Something","young",8
"190","tv","Something","old",4
> decompress=function(x)x[rep(1:nrow(x),x$length),-ncol(x)]
> exstatus=decompress(y)
,然後劇情
ggplot(exstatus, aes(x=type, fill=art))+
geom_bar(aes(y=..count../sum(..count..)),position="dodge")
的問題是,最右邊的兩個杆(「年輕」,「老」)是太厚 - 「東西」佔據了整個寬度 - 這是不是我想要的。
alt text http://www.imagechicken.com/uploads/1272295176088679800.png
我很抱歉,我不能更好地解釋它。
如果你的數據是否有「完成」無值或在「年輕」和「老」「參加」,做自己然後呢?你是否想要一個帶有空的第三欄的3杆組? – 2010-04-25 16:50:09
也許嘗試繪製你想要的圖形(或者只是改變ggplot輸出)。真的不清楚你想要什麼。 – 2010-04-25 17:12:22
是的。基本上有3個可能的酒吧。對於3個第一簇,應該可見兩個柱,對於最後兩個簇應該隱藏兩個柱。 現在我計算兩次「年輕」和「老」 - 因此thichk酒吧。 我會嘗試用一個更新的問題來更好地解釋我的自我。謝謝尼古拉斯。 – Andreas 2010-04-25 19:27:52