Sameer Mathur
attach(mtcars)
plot(wt, mpg)
plot(wt, mpg,
col="blue",
xlim=c(0, 8), ylim=c(0, 45),
main="Plot of MPG vs Car Weight",
xlab="Weight ('000 lbs)", ylab="Miles Per Gallon")
plot(wt, mpg,
col="blue",
xlim=c(0, 8), ylim=c(0, 40),
main="Plot of MPG vs Car Weight",
xlab="Weight ('000 lbs)", ylab="Miles Per Gallon")
abline(h=mean(mpg), col="red", lty="dashed")
abline(v=mean(wt), col="blue", lty="dotted")
Add Sample Mean lines to the Scatterplot
attach(mtcars)
plot(disp, mpg,
col="black",
main="Basic Scatterplot of MPG vs. Displacement",
xlab="Displacement",
ylab="Miles Per Gallon", pch=19)
abline(h=mean(mpg), col="red", lty="dotted")
abline(v=mean(disp), col="blue", lty="dotted")
Add Sample Mean lines to the Scatterplot