【发布时间】:2023-01-01 00:06:08
【问题描述】:
I would like to add the red line
我正在尝试添加一个函数来覆盖我制作的散点图,理想情况下输出类似于图片中涂有红线的输出。我怎样才能在我的散点图中添加一个函数(例如 y=C/ln(x) 形式的函数)?我将调整常量以尝试使其与图像中粗略绘制的其余线条相匹配。
这是我当前的代码,其中 x 和 y 值来自收集的数据表 -
View(DataCollection)
plot(x=DataCollection$`x`, y= DataCollection$`y`,
xlab = "x",
ylab = "y",
xlim = c(0, 2000),
ylim = c(0, 100),
pch=20,
cex=0.2,
main = "y against x",
)
【问题讨论】:
-
@DAveArmstrong 发布了
ggplot2answer。base-plot 系统中的答案是函数curve。
标签: r function rstudio line scatter-plot