如何在ggplot2中指定回归线的方程? [英] How to specify equation for regression line in ggplot2?
问题描述
我想在ggplot2中创建一个或多个覆盖线的散点图。查看了geom_smooth()和geom_line()的文档后,我仍不清楚如何指定要添加到图的线的方程式。我明白这一定是非常基本的,所以请随时简单地指出我必须忽略的适当文件。 解决方案
p> geom_abline()
是您要查找的geom的名称,例如 geom_abline(AES(截距= A,斜率= b))的
。 在线文档中有一些示例。
I want to create a scatterplot in ggplot2 with one or more lines over-layed. Having looked at the documentation for geom_smooth() and geom_line(), it remains unclear to me how I can specify the equations for lines that I want to add to a plot. I understand that this must be very basic, so please feel free simply to point me toward the appropriate documentation that I must have overlooked.
geom_abline()
is the name of the geom you're looking for, e.g. geom_abline(aes(intercept=a,slope=b))
. There are examples in the online documentation.
这篇关于如何在ggplot2中指定回归线的方程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!