Monday, April 8, 2013

RG#32: XY plot with rug at margin

# data
x= rnorm(1000, 5,3)
 myd <- data.frame (x= x, y = x*0.45 + rnorm(1000, 0,1))

# plot
require (ggplot2)
qplot(x,y, data=myd) + scale_x_continuous(limits=c(min(myd$x),max(myd$x))) +
  scale_y_continuous(limits=c(min(myd$y),max(myd$y))) +         
geom_rug(col=rgb(.5,0,0,alpha=.2)) + theme_bw()

 

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.