【问题标题】:R: use bin counts and bin breaks to get a histogramR:使用 bin 计数和 bin 中断来获得直方图
【发布时间】:2017-02-03 17:14:27
【问题描述】:

我从正态分布生成了一个随机向量并绘制了一个直方图。

我修改了每个 bin 的计数,我想绘制另一个具有相同中断 (break_vector) 和新 bin 计数向量 (new_counts) 的直方图。

怎么做?

我尝试了 barplot(),但它显​​示 bin 标签的方式不同。

x = rnorm(500,1,6)
delta = 1
break_vector = seq(min(x)-delta,max(x)+delta,by=delta)
hist_info = hist(x,breaks=break_vector)

new_counts = hist_info$counts+5

【问题讨论】:

    标签: r plot histogram


    【解决方案1】:

    试试

    new_hist <- hist_info
    new_hist$counts <- hist_info$counts + 5
    plot(new_hist)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-05-31
      • 2021-11-03
      • 2013-10-08
      • 2018-06-22
      • 1970-01-01
      • 1970-01-01
      • 2013-04-03
      • 2011-01-17
      相关资源
      最近更新 更多