Skip to content

Instantly share code, notes, and snippets.

@Akiyah
Created November 18, 2019 00:26
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 Akiyah/b33e54c0f17bec7cadf1ac3348119ea6 to your computer and use it in GitHub Desktop.
Save Akiyah/b33e54c0f17bec7cadf1ac3348119ea6 to your computer and use it in GitHub Desktop.
draw <- function(l, filename) {
png(filename, width=500, height=500)
barplot(dpois(0:10, l), names.arg=0:10, ylim=c(0,1), col="#993435")
text(5, 0.8, paste0("λ=", sprintf("%1.1f", l)), cex=5)
dev.off()
}
l <- (1:50) / 10
for (i in 1:length(l)) {
draw(l[i], sprintf("plot_%04d.png", i))
draw(l[i], sprintf("plot_%04d.png", length(l)*2 - i + 1))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment