Below are the solutions to these exercises on plot data.

############### # # # Exercise 1 # # # ############### attach(mtcars) plot(mpg,drat)

#a. mpg is on x axis ############### # # # Exercise 2 # # # ############### #a. For continuous variables. Dichotomous variables have to be plotted by histogram ############### # # # Exercise 3 # # # ############### hist(gear)

#a. Frequency ############### # # # Exercise 4 # # # ############### plot(mpg,drat,type="l")

############### # # # Exercise 5 # # # ############### plot(mpg,drat,type="b")

############### # # # Exercise 6 # # # ############### plot(mpg,drat);points(mpg,wt)

############### # # # Exercise 7 # # # ############### plot(mpg,drat,col=2) #a red ############### # # # Exercise 8 # # # ############### plot(mpg,drat,col=2);points(mpg,wt,col=3)

plot(mpg,drat,col=2,type="l");lines(mpg,wt,col=3)

############### # # # Exercise 9 # # # ############### plot(mpg,drat,lwd=2)

############### # # # Exercise 10 # # # ############### plot(mpg,drat,col=2,lwd=2,ylim=c(0,30));points(mpg,wt,col=3);points(mpg,qsec,col=4)

plot(mpg,drat,col=2,type="l",ylim=c(0,30));lines(mpg,wt,col=3,lwd=2);lines(mpg,qsec,col=4)

## Leave a Reply