Optical Art with R

July 16, 2012
By

(This article was first published on R de jeu, and kindly contributed to R-bloggers)

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 his blog: R de jeu.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



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.