VictorBing

导航

Scatterplots 散点图

Simple Scatterplot

# Simple Scatterplot

attach(mtcars)
plot(wt, mpg, main="Scatterplot Example", 
   xlab="Car Weight ", ylab="Miles Per Gallon ", pch=19)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

# Add fit lines—添加回归线和lowess线

abline(lm(mpg~wt), col="red") # regression line (y~x) 
lines(lowess(wt,mpg), col="blue") # lowess line (x,y)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

来源:

Quick-R http://statmethods.net/graphs/scatterplot.html

posted on 2016-03-14 15:52  VictorBing  阅读(679)  评论(0)    收藏  举报