【发布时间】:2014-08-29 10:06:27
【问题描述】:
我在尝试用 ggplot 绘制一个非常标准的随机变量的直方图时得到了一些奇怪的结果。
RB = rbinom(10000000,100,.3)
qplot(RB)#histogram of the distrib with ggplot2. Assumes 30 buckets by default
dev.new()
hist(RB,breaks=30)#same with regular histogram
dev.new()
qplot(RB,binwidth=1)#if we force binwidth to 1 it seems to work
dev.new()
hist(RB,breaks=range(RB)[2]-range(RB)[1])
第一次调用 qplot 的结果很奇怪。根据抽奖次数,我们希望图表显示平滑分布。
我使用 ggplot2 版本 1.0.0 和 R 3.0.2
【问题讨论】: