Skip to content

Instantly share code, notes, and snippets.

@gireeshkbogu
Last active January 22, 2016 10:36
Show Gist options
  • Save gireeshkbogu/a9e2124ed09787dd18ec to your computer and use it in GitHub Desktop.
Save gireeshkbogu/a9e2124ed09787dd18ec to your computer and use it in GitHub Desktop.
Rug plot - an laternative to show a scatter plot with densities
library(ggplot2)
x<-rnorm(300)
y<-rt(300,df=2)
xy<-data.frame(x,y)
qplot(x,y, data=xy) +
scale_x_continuous(limits=c(min(x),max(x))) +
scale_y_continuous(limits=c(min(y),max(y))) +
geom_rug(col=rgb(.5,0,0,alpha=.2))
@gireeshkbogu
Copy link
Author

rug plot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment