Skip to content

Instantly share code, notes, and snippets.

@wabarr
Created November 12, 2013 19:28
Show Gist options
  • Save wabarr/7437164 to your computer and use it in GitHub Desktop.
Save wabarr/7437164 to your computer and use it in GitHub Desktop.
code to make an image with nice texture in ggplot
library(ggplot2)
library(reshape2)
n <- 7000
theMean <- 0
theSD <- 5
A <- rbinom(n,1,c(.5,.5)) + rnorm(n,theMean,theSD)
B <- rbinom(n,1,c(.5,.5)) + rnorm(n,theMean,theSD)
C <- rbinom(n,1,c(.5,.5)) + rnorm(n,theMean,theSD)
modelID <- 1:n
dataFrame <- melt(data.frame(A,B,C,modelID),id="modelID")
ggplot(data=dataFrame, aes(x=variable,y=value,group=modelID)) + geom_path(size=.5,alpha=.02) + theme_classic(20)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment