【问题标题】:How to specify equation for regression line in ggplot2?如何在ggplot2中指定回归线的方程?
【发布时间】:2013-02-16 17:34:17
【问题描述】:

我想在 ggplot2 中创建一个散点图,其中覆盖了一条或多条线。查看 geom_smooth() 和 geom_line() 的文档后,我仍然不清楚如何为要添加到绘图的线指定方程。我知道这必须是非常基本的,所以请随时简单地向我指出我必须忽略的相应文档。

【问题讨论】:

  • geom_abline(),例如geom_abline(aes(intercept=a,slope=b)) ...见?geom_abline
  • 文档似乎提供了一些示例:docs.ggplot2.org/0.9.3/geom_smooth.html
  • @BenBolker:提出解决方案,我会接受。谢谢!

标签: r ggplot2


【解决方案1】:

geom_abline() 是您要查找的 geom 的名称,例如geom_abline(aes(intercept=a,slope=b))the online documentation中有例子。

【讨论】:

    猜你喜欢
    • 2015-10-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-18
    • 1970-01-01
    • 2015-01-15
    相关资源
    最近更新 更多