Skip to content

Instantly share code, notes, and snippets.

@CnrLwlss
Created February 13, 2021 15:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CnrLwlss/993e0115f672f0a54ba7cf6be2cfe69c to your computer and use it in GitHub Desktop.
Save CnrLwlss/993e0115f672f0a54ba7cf6be2cfe69c to your computer and use it in GitHub Desktop.
Plotting random walks
N = 10000
Ncurve = 1000
png("Walk.png",width=3000,height=1000,pointsize=12,type="cairo-png")
plot(NULL,ylim=c(-200,200),axes=FALSE,xlim=c(N/2,N),xlab="",ylab="")
for(i in 1:Ncurve) points(cumsum(rnorm(N,0,0.5)),type="l",col=rgb(0,0,0,0.1),lwd=2)
dev.off()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment