如何从 R 中的绘图中找到给定 y 值的 x 值

How to find the x-value given the y-value from a plot in R

我正在使用 R 3.4.3,并绘制了以下函数:

x =  rnorm(5000,20,30)
cdf_1 <- ecdf(x)  
plot(cdf_1, xlabs="x0",  
     ylabs="y0")

这给了我以下情节:

现在,绘图不采用给定的标签 x0 和 y0。如何解决?

此外,如何获得 y=0.95 时的 x 值。 我试过使用标签名称,但它会引发错误。 欢迎推荐。

标签的参数是 xlabylab(您在两者中都添加了一个额外的 s):

要找到 xy 为 0.95,您可以这样做:

x[which(cdf_1(x) == 0.95)]
#[1] 68.38452