Animation Newby Excercise with R-Package {animation}

December 12, 2011
By

[This article was first published on theBioBucket*, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Try this very simple & illustrative example for creating an animation with the animation package:

myfun <- function ( ) {
n = ani.options("nmax")
x = sample(1:n)
y = sample(1:n)

for (i in 1:n) {
plot(x[i], y[i], cex = 3, col = 3, pch = 3, , lwd = 2,
ylim = c(0, 50),
xlim = c(0, 50))
ani.pause()
}
}

ani.start()
par(mar = c(3, 3, 1, 0.5), mgp = c(1.5, 0.5, 0), tcl = -0.3)
myfun()
ani.stop()

To leave a comment for the author, please follow the link and comment on their blog: theBioBucket*.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Tags: ,

Comments are closed.

Search R-bloggers

Sponsors

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)