Below are the solutions to these exercises on how to customize a scatterplot.

############### # # # Exercise 1 # # # ############### attach(mtcars) plot(mpg,drat,xlab="Miles per gallon")

############### # # # Exercise 2 # # # ############### plot(mpg,drat,xlab="Miles per gallon",ylab="Rear axle ratio")

plot(mpg,drat,xlab="Miles per gallon",ylab="Rear axle ratio",xlim=c(0,30),col=2,lwd=2,ylim=c(0,7))

############### # # # Exercise 3 # # # ############### plot(mpg,drat,main="Miles vs Rar")

############### # # # Exercise 4 # # # ############### plot(mpg,drat,axes=F) axis(side=1,at=c(0,40)) axis(side=2,at=c(0,10)) mtext("Miles vs Rar",side=3) mtext("Miles",side=1) mtext("Miscellaneous",side=2)

############### # # # Exercise 5 # # # ############### plot(mpg,drat) points(mpg,wt,col=2) legend("topright",legend=c("Rar","Wt"),col=1:2,ncol=2,pch=1)

############### # # # Exercise 6 # # # ############### plot(mpg,drat,pch=2) points(mpg,wt,col=3,pch=2) legend("bottomright",legend=c("Rar","Wt"),col=c(1,3),ncol=3,pch=2,bg="light blue")

plot(mpg,drat) points(mpg,wt,col=3,pch=3) points(mpg,cyl,col=2,pch=2) legend("bottomright",legend=c("Rar","Cyl","Wt"),col=c(1:3),ncol=3,pch=1:3,bg="light blue")

############### # # # Exercise 7 # # # ############### plot(mpg,drat,axes=F,xlab="",ylab="") points(mpg,wt,pch=2,col=2,xlab="",ylab="") points(mpg,cyl,pch=3,col=3,xlab="",ylab="") axis(side=1,at=c(0,40)) axis(side=2,at=c(0,30)) mtext("Miles vs Miscellaneous",side=3) mtext("Miles",side=1) mtext("Miscellaneous",side=2) legend("topright",legend=c("Rar","Weight","Cyl"),col=c(1:3),ncol=3,pch=1:3,bg="light blue")

Usman says

Great work. Please also share some exercises about plotting using ggplot2.