2

ヒストグラムで正しい数のビンをプロットするのに少し苦労しています。各ビンを1〜5、5〜10、10〜15などの値にしたいのですが、stat_binを使用すると、範囲/30のデフォルトに戻ります。

ggplot(tmp,aes(x = values)) + 
+     facet_wrap(~ind) +
+     geom_histogram(aes(y=..count../sum(..count..)),stat="bin")+
+     scale_x_continuous("Percent above 30x")+
+     scale_y_continuous("Fraction of panel")+
+     opts(title = yz)+
+     stat_bin(bandwidth=5.0)
stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust this.

読んでいる間、私が完全に理解していなかったのは、ばかげた構文のことかもしれないと思っていました。なぜこれが起こっているのか誰かが私にアドバイスしてくれることを望んでいました。

4

1 に答える 1

1

OP はこの解決策を投稿しました: add binwidth=5argument to geom.

ggplot(tmp,aes(x = values)) +
    facet_wrap(~ind) +
    geom_histogram(aes(y=..count../sum(..count..)), binwidth=5)+
    scale_x_continuous("Percent above 30x")+
    scale_y_continuous("Fraction of panel")+
    opts(title = yz)
于 2012-08-16T17:50:06.157 に答える