wangying2121 发表于 2013-5-23 11:00 
太感谢了,貌似有点那个感觉了,您知道后面那个箱式图的颜色怎样调吗?
Try to add a color 'yellow' that may close enough
x <- rnorm(10000)*5
err<- rnorm(10000)
dat <- data.frame(x = x,y = 1+2*x + 5*err,
y2 = 3+2*x + 5*err, y3 = -1+2*x + 10*err)
cPal <- colorRampPalette(c('blue','orange', 'yellow'))
dat$Col <- cPal(50)[as.numeric(cut(dat$y,breaks = 50))]
plot(dat$x,dat$y,pch = 20,col = dat$Col)
abline(lm(dat$y~dat$x), col="black")
abline(lm(dat$y2~dat$x), col="green")
abline(lm(dat$y3~dat$x), col="pink")
grid()