举个例子:
ggplot(iris,aes(Sepal.Width,Sepal.Length)) + geom_smooth()如何获得用于绘制这条蓝色曲线的x和y?
这个案例将由loess自动计算,我的真实案例将由gam自动计算。
我试过:
gam函数复制它也没有成功的机会
发布于 2017-10-09 11:46:15
就我所理解的问题而言,试试这种方法:
library(gam)
library(broom)
mod <- gam(Sepal.Length ~ Sepal.Width, data = iris)
ggplot(iris, aes(Sepal.Width,Sepal.Length)) + geom_point() +
geom_line(data = augment(mod, type.predict = "response"),
aes(y = .fitted), color = "blue")https://stackoverflow.com/questions/46645463
复制相似问题