Optical Art with R

[This article was first published on R de jeu, 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.

Last week, in a post entitled Bridget Riley exhibition in London, the author Markus Gesmann wrote an R script reproducing one of Riley’s famous art pieces: Movement in Squares.

This reminded me of my own first “brush” with Op art. It was in art class years ago, our professor (Madame Vitré) had asked that we recreate an interesting piece. The concept in itself was easy: pick two points and draw a number of lines through each of them. Where they intersect, the two sets of lines create a multitude of polygons that can be filled in black or white alternatively, for quite a dramatic result.

As you can imagine, it was tedious work on paper. Years later, I’d get a thrill at doing it in just a couple minutes using Paint on Windows. Well, here I am again in 2012, now a grown-up programmer:



The example above was run using P = 2, N = 30, and colors = c(“black”, “white”). And here is a nice series using three points and colors from the brewer palette:
P = 3, N = 12,
colors = brewer.pal(3, “Reds”)
P = 3, N = 15,
colors = brewer.pal(3, “Purples”)
P = 3, N = 15,
colors = brewer.pal(3, “Blues”)
P = 3, N = 9,
colors = brewer.pal(3, “Greens”)

Madame Vitré would be proud. (or horrified?)

To leave a comment for the author, please follow the link and comment on their blog: R de jeu.

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.

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)