【问题标题】:R- how to plot cumulative linesR-如何绘制累积线
【发布时间】:2020-11-17 15:31:42
【问题描述】:

我的问题如下:

我必须绘制一条曲线,显示故障次数 (y) 按使用寿命 (x) 但以累积方式 - 这就是我挣扎的地方!!

第二张图给出了解决方案,我的代码在第一张(我觉得只是情节的类型应该不同)

my code solution

非常感谢您的每一个帮助!

【问题讨论】:

    标签: r plot statistics histogram cumulative-sum


    【解决方案1】:

    我无法复制你的数据,所以这更像是一个评论,然后是一个完整的解决方案。

    n <- sum(h$counts)          # This should sum up to the number of observations
    y <- cumsum(h$counts) / n   # Your y values
    x <- h$mids                   # I assume these to be your x-axis value, but this might need an edit.
    plot(x = x, y = y, type = "l")
    

    最后,您可以通过abline()函数在各个点添加垂直和水平线。

    【讨论】:

      猜你喜欢
      • 2021-05-04
      • 1970-01-01
      • 2021-06-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多