Skip to content

Instantly share code, notes, and snippets.

@abikoushi
Created July 25, 2017 17:31
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 abikoushi/2e9bcb28f13fdc299065e82a66c6b5f5 to your computer and use it in GitHub Desktop.
Save abikoushi/2e9bcb28f13fdc299065e82a66c6b5f5 to your computer and use it in GitHub Desktop.
JacksonPollock <- function(n=5,r1=5,r2=0.5,drip=100,col="black"){
old<-par(no.readonly = TRUE)
par(mai=c(0,0,0,0))
plot(c(0,1),c(0,1),type="n")
pos<-locator(n)
points(pos$x,pos$y,cex=rexp(n,1/r1),pch=16,col=col)
d <-rpois(1,drip)
u <-runif(d)
for(i in 2:n){
points(u*pos$x[i-1]+(1-u)*pos$x[i],u*pos$y[i-1]+(1-u)*pos$y[i],
cex=rexp(d,1/r2),pch=16,col=col)
}
par(old)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment