Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想使用以下线性方程在绘图上画一条直线。
y = 2.522x-1.331
我使用以下代码获取散点图。
data=read.csv("C://book.csv") plot(data$x,data$y)
您需要使用功能abline:
abline
abline(a=-1.331, b=2.522)
参数a是截距,参数b是斜率。有关?abline更多详细信息,请参阅。
a
b
?abline
使用abline,例如
abline(-1.331, 2.522)