Thursday, 28 March 2013

Plotting in R

Session 10, March 26th, 2013

Assignment 1: 

Create 3 vectors x,y,z and choose any random values for them.

T<-cbind(x,y,z)

Create 3-dimentional plot of the same



plot3d(T)



 plot3d(T,col=rainbow(1000))


plot3d(T,col=rainbow(1000),type='s')


Assignment 2 : 

Create 2 random variables x,y & create a few plots showing
  • X-Y
  • X-Y|Z ( Introduce a variable z and cbind it to z and y with 5 different categories ... Hint : ?factor)
  • Color code and draw the graph
  • Smooth and fit line for the curve


qplot(x,y)



qplot(x,z)


 qplot(x,z,alpha=I(1/10))


qplot(x,z,alpha = I(1/30))


qplot(x,y,geom=c("boxplot", "jitter"))



qplot(x,y,geom=c("point", "smooth"))


qplot(x,y,colour=z)


qplot(log(x),log(y), colour=z)



No comments:

Post a Comment