Coded as follows:
x = seq(.001,50,.001) par(bg="black") par(mar=c(0,0,0,0)) plot(x,sin(1/x)*rpois(length(x),x),pch=20,col="blue")
$100 to the first person who can figure out how I created this plot and replicate it. Some hints:
rdist()“).This is based on a random sampling of unstated size, so I don’t expect that your graph will be an absolute, exact match.
I’ll add $1 to the prize for every day that goes by without a winner until the end of the year. After that I’ll consider it an unsolved mystery and reveal the code I used.
Post your guesses for the code as a comment to this post. First correct answer wins. Good luck to all!
Make sure to click on the image to see the large version. Code for this graph:
moxbuller = function(n) { u = runif(n) v = runif(n) x = cos(2*pi*u)*sqrt(-2*log(v)) y = sin(2*pi*v)*sqrt(-2*log(u)) r = list(x=x, y=y) return(r) } r = moxbuller(50000) par(bg="black") par(mar=c(0,0,0,0)) plot(r$x,r$y, pch=".", col="blue", cex=1.2)
Not easy to produce cool looking graphs in R, but it can be done. The results of some messing around are above. Here is the code I used:
x = runif(1000) y = x/runif(1000) cexes = 10*y/max(y) # For circle size par(bg="black") # I see a white background and I want it painted black. par(mar=c(0,0,0,0)) # Margins? We don't kneed no stinkin' margins. plot(x,log(y), pch=20, col="white", cex=cexes)