R将绘制但不会绘制abline

scr*_*Owl 14 plot r

> head(returnee)
[1]  1.3936536 -0.6730667  2.3584725  2.3477308  3.2841443  1.3168157
> head(vixee)
[1] 14.75 15.45 17.59 17.74 17.75 18.35
> class(returnee)
[1] "numeric"
> class(vixee)
[1] "numeric"
> plot(returnee, vixee)
> abline(lm(returnee ~ vixee))
Run Code Online (Sandbox Code Playgroud)

当我运行它时,它给出了情节,但没有下划线.有什么建议?谢谢.

Ana*_*liy 22

它应该abline(lm(vixee ~ returnee))匹配图的坐标.


Ben*_*ker 13

与@AK相比,我打算说你的情节倒退了.一个或另一个...如果回归是您想要的方式(即y~x),那么尝试其中之一

plot(vixee ~ returnee)  ## formula interface, y~x
Run Code Online (Sandbox Code Playgroud)

要么

plot(returnee,vixee)    ## standard interface, (x,y)
Run Code Online (Sandbox Code Playgroud)