0

情報量の少ないタイトルでごめんなさい。

> 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")

問題は、右端の2つのバー(「若い」、「古い」)が太すぎることです。「何か」が幅全体を占めますが、これは私が意図したものではありません。

代替テキストhttp://www.imagechicken.com/uploads/1272295176088679800.png

うまく説明できず申し訳ありません。

4

1 に答える 1

3

position="dodge"の代わりにfacet_gridを使用してください

  ggplot(exstatus, aes(x=art, fill=art))+
  geom_bar(aes(y=..count../sum(..count..))) + 
  facet_grid(~type,scales="free",space="free")

代替テキストhttp://www.imagechicken.com/uploads/1272294360054813000.png

于 2010-04-26T14:04:00.710 に答える