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","youn开发者_运维问答g",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
I am sorry that I can not explain it better.
Use facet_grid instead of 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
精彩评论