The accidental aRt tumblr (mentioned here a few years ago) continues to provide a steady stream of images that wouldn’t look out of place in a modern art gallery, but which in fact are data visualizations (mostly attempted in R), gone wrong. (Here’s a typical recent entry.) But now, Giora Simchoni has taken this concept to the next level by writing an R package that deliberately creates works of art.
The kandinsky package (available now on Github) takes any dataset as input, and creates an image reminiscent of the work of abstract painter Wassily Kandinsky. The data points are used to position Kandinsky’s typical motifs — rectangles, circles, waves and such — on a digital canvas. And since every data set is different, the resulting “work” is therefore unique. Here, for example, Len Kiefer takes a break from his usual visualizations of economic data to create a Kandinsky plot of mortgage rates:
was going to make my usual time series gif of mortgage rates, but I decided to tween Kandinsky instead. sequence of rates 4 weeks at a time pic.twitter.com/mMnOxGxVcW
— Leonard Kiefer (@lenkiefer) July 27, 2017
Andrew Clark used the same package to generate Kandinsky plots from baseball data. With a simple Shiny app, you can choose a player represented in the Lahman package and use their data to create a chart on the fly:
Behind the scenes, the kandinsky package uses the grid graphics system in R to lay out the elements of the “painting” on a blank canvas. The grid system isn’t often used directly, but it’s what’s behind many of the modern graphics systems in R (notably, lattice and ggplot2). If you’re thinking about creating an entirely new visualization in R, as Giora Simchoni has done here, the grid package is well worth looking into. You can learn a lot about its capabilities in the blog post linked below.
Giora Simchoni: Data Paintings (The Kandinsky Package)