To not see the "spiderweb", sort your x-values before putting them to a line. Below I used order
to get the order of the x-values, should work if there are no NAs in your x and y variables:
set.seed(111)
bmi <- runif(1000,1,50)
pbfm <- 1.5*bmi + 0.05*bmi^2 +rnorm(1000,0,30)
mod3 <- lm(pbfm ~ bmi + I(bmi^2))
plot(bmi, pbfm,cex=0.3)
o <- order(bmi)
lines(bmi[o], predict(mod3)[o],col="blue")
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…