【问题标题】:Label ECDF plot points标记 ECDF 图点
【发布时间】:2012-03-19 09:59:48
【问题描述】:

我正在尝试用我的数据字段中的另一列标记 ECDF 图的点。 目前我正在使用这个:

untouched = read.table("results-untouched.tsv", sep="\t")
plot.ecdf(untouched$V4, xlim=c(0.75,1.25), ylim=c(0,1), col='green', verticals=T)

绘图没问题,但我无法将标签添加到点。标签将位于untouched$V1

你知道怎么做吗?

【问题讨论】:

    标签: r plot cdf ecdf


    【解决方案1】:

    要添加标签,您可以使用text 函数。比如我们生成一些数据

    x = sort(rnorm(10))
    

    然后创建 ecdf 对象(plot.ecdf 自动执行此操作),

    m = ecdf(x)
    

    并绘制m

    plot(m)
    

    要添加标签,我们使用text 函数。 x 坐标是数据,y 坐标是ecdf 函数的输出(加上 0.03 以避免过度绘图):

    text(x, m(x) + 0.03, LETTERS[1:10])
    

    【讨论】:

      猜你喜欢
      • 2021-11-16
      • 1970-01-01
      • 2017-12-22
      • 1970-01-01
      • 2019-03-26
      • 2014-03-17
      • 2015-05-31
      • 2019-09-30
      • 1970-01-01
      相关资源
      最近更新 更多