【问题标题】:Plotting numeric frequency data based on midpoints of bins in base R or ggplot根据基础 R 或 ggplot 中 bin 的中点绘制数字频率数据
【发布时间】:2016-01-08 16:04:00
【问题描述】:

我正在复制已发表研究的模拟结果。作者在一个非常矩形的密度图(下图)中展示了他们的输出。他们似乎已经创建了垃圾箱,然后绘制了垃圾箱的中点。是否可以使用 base R 图形或 ggplot 轻松构建这种类型的绘图?

【问题讨论】:

标签: r plot ggplot2 histogram density-plot


【解决方案1】:

确实很简单:

data=rnorm(1000)
hist_info=hist(data, plot=F)
plot(hist_info$mids, hist_info$density, type="l", xlab="X", ylab="density")

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-04-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多