我经常使用scatter.smooth
函数,但我想知道是否可以直接将title
或main
参数添加到此函数中。我阅读了功能的描述,但没有找到可能性。我知道还有其他方法可以做到这一点,但如果可能的话我想保留这一点。是否可以为scatter.smooth添加标题?
d <- data.frame(x = sample(20, 500, prob=c(1:10, 10:1), replace = TRUE),
y = sample(20, 500, prob=c(1:10, 10:1), replace = TRUE),
z = rnorm(500, 20, 4))
mo <- lm(y ~ z, d)
fig <- function(x) {
scatter.smooth(fitted(x), residuals(x, type = "response"), col = "red")
abline(0, 0, lty = 2)
legend("topright", legend = c("loss", "0-0"), lty = c(1, 2))
}
fig(mo)
函数'scatter.smooth()'可用作R-source。它没有'title'和'main'的参数。恕我直言,在这方面的功能类似于'points()'。 – jogo