在图表上打印R中的最佳拟合直线方程
您好,我已经使用python中的matplotlib创建了下图。 该图显示了每组的最佳拟合线在图表上打印R中的最佳拟合直线方程,r,R,您好,我已经使用python中的matplotlib创建了下图。 该图显示了每组的最佳拟合线 我想在R中复制相同的过程,并在每行顶部打印最佳拟合线方程,请建议 你的问题有些含糊 我知道的一个内置R函数是abline() 引用?abline()帮助命令 Description This function adds one or more straight lines through the current plot. Usage abline(a = NULL, b = NULL, h = N
我想在R中复制相同的过程,并在每行顶部打印最佳拟合线方程,请建议 你的问题有些含糊 我知道的一个内置R函数是
abline()
引用?abline()
帮助命令
Description
This function adds one or more straight lines through the current plot. Usage
abline(a = NULL, b = NULL, h = NULL, v = NULL, reg = NULL,
coef = NULL, untf = FALSE, ...)
Arguments a, b
the intercept and slope, single values. untf
logical asking whether to untransform. See ‘Details’. h
the y-value(s) for horizontal line(s). v
the x-value(s) for vertical line(s). coef
a vector of length two giving the intercept and slope. reg
an object with a coef method. See ‘Details’. ...
graphical parameters such as col, lty and lwd (possibly as vectors: see ‘Details’) and xpd and the line characteristics lend, ljoin and lmitre.
abline
这并不是你想要的,因为它会产生直线。但它已经是最合适的产品线了
您还可以大致浏览?行
,看看什么最适合您
另一个建议是简单地展示一个代码示例,这样我们就可以看到您做了什么,并提出了关于R中实现的想法。DoIt?老实说,我看不出你想要什么。线条的方程式是什么?你可以用
ggplot2
轻松做到这一点,请提供你的数据的dput
。关于David a的评论,请访问