I am sorry for the non-informative title.
我很抱歉没有信息的标题。
> 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)
and then the plot
然后是情节
ggplot(exstatus, aes(x=type, fill=art))+
geom_bar(aes(y=..count../sum(..count..)),position="dodge")
The problem is that the two rightmost bars ("young", "old") are too thick - "something" takes up the whole width - which is not what I intended.
问题是两个最右边的条(“年轻”,“旧”)太厚 - “某些东西”占据了整个宽度 - 这不是我想要的。
alt text http://www.imagechicken.com/uploads/1272295176088679800.png
替代文字http://www.imagechicken.com/uploads/1272295176088679800.png
I am sorry that I can not explain it better.
对不起,我无法更好地解释它。
1 个解决方案
#1
3
Use facet_grid instead of position="dodge"
使用facet_grid而不是position =“dodge”
ggplot(exstatus, aes(x=art, fill=art))+
geom_bar(aes(y=..count../sum(..count..))) +
facet_grid(~type,scales="free",space="free")
alt text http://www.imagechicken.com/uploads/1272294360054813000.png
替代文字http://www.imagechicken.com/uploads/1272294360054813000.png
#1
3
Use facet_grid instead of position="dodge"
使用facet_grid而不是position =“dodge”
ggplot(exstatus, aes(x=art, fill=art))+
geom_bar(aes(y=..count../sum(..count..))) +
facet_grid(~type,scales="free",space="free")
alt text http://www.imagechicken.com/uploads/1272294360054813000.png
替代文字http://www.imagechicken.com/uploads/1272294360054813000.png