Data as Art - Data as Culture

Data as Art – Data as Culture

Having just typed the original title of this blog post ‘Data as Art’ I realize it is probably the millionth blog to share it. A minor modification should help to identify it among the countless others…

This week, as the newly founded Open Data Institute (ODI) embraces data-as-culture I am reminded about a visualization I attempted a short while back – visualizing prime numbers.

Contemplating prime numbers at work I wondered if there are any visual patterns in the distribution of bits which make up prime numbers. A pattern which at bit-level might lead to a method of discovering larger and larger prime numbers. Not being a mathematician and struggling personally with the fundamentals of mental arithmetic (I’m better with a pen and paper and algebra) I appreciated this idea was neither very sophisticated or likely to throw up anything useful. It did however present a useful excuse to write a Python script… A script that has since been lost sitting outside of source control.

This blog isn’t about that script, unfortunately, but I can cover what I have managed to recover, including some pre-processing work and a handful of images created from it. I guess you could say they’re one-of-a-kind originals, although they’d be fairly easy to re-create.


Doing a Google search for lists of prime numbers one can find the resources needed to begin this work. The concept is taking each prime number in turn and outputting the binary representation of that number visually. 255 prime and non-prime numbers can be represented in what is considered to be a byte: 8-bits of data. Taking a more significant amount of data (500 prime numbers) you need more bits – 12. So for 2,3,5,7,11…3571 (500th prime) you get data that looks a little bit like this:



The most basic visualization I was able to imagine was to create a color pixel for each byte that is set and leave it black for each byte that isn’t set and arrange that in some meaningful way across a canvas.

This gives us two scripts. One which takes a list of numbers and outputs the binary representation and another which reads a list of binary numbers and outputs pixel data. I did it in two scripts to easily re-factor the work and create new scripts based on lists of binary data at a later date.

At this point there isn’t much else to consider. Taking the pixel drawing functions from a library such as the Python Imaging Library we can read each binary representation line by line and for each bit plot a pixel giving it color and dimensions in 2D space. We must consider the size of plotted areas for aesthetic reasons and how we should distribute pixels spatially.

In my scripts I decided vertical spacing of wide but low-depth blocks of data would be best. I used horizontal borders to help frame the work. Colors were set randomly from a set of four which I found most pleasing.

Every time the script was run it would create a slightly different image based on color. This could have been extended to any of the other properties and may have lead to some interesting images.

The Results

Unfortunately that is all there is to say about the code. I would much prefer to have blogged about that and let everyone run it. Having said that, there is enough information here for me to remember how to rework this piece and let others give it a go for themselves. In lieu of those scripts, here is a look at the output:

The full effect (500 primes):

A landscape of 500 prime numbers

Link (Right-click ‘Save link as…’)

Half the effect (250 primes):

A landscape of 250 prime numbers

Link (Right-click ‘Save link as…’)

Tiled prime numbers:

Prime numbers tiled across a 1000 x 1010 square

Link (Right-click ‘Save link as…’)

1% of the effect (5 primes):

Visualization of five prime numbers

[NOTE: I need to investigate this image further, it seems to consist of 14-bit numbers and therefore beyond the 500 prime list. I’m not sure when and how it was generated… I may have had a larger primes list, hmm…]

And an obligatory Instagram of the work:

Textures are just lovely aren’t they?! (I generally don’t dig Instagram but it is convenient.)


The visualizations here aren’t art. They’re confusing to look at and not particularly pretty. They do however represent a script where the code may be even prettier than the output. I tend to go with definitions of art which discuss the idea of evoking an emotional response from the participant (in the experience). Anything else is in the realm of graphics design, or simply nothing at all (like magic).

Visualizations and infographics can go a long way to satisfying a Freudian visual ‘fixation’ – instant gratification – temporary satisfaction on the initial sighting of something different, something novel, but not a feeling which lasts in perpetuity. (What’s your favorite visualization? …What’s your favorite piece of art?)

I like what the ODI are attempting and I am sure they’ll attract people who can create art out of data but it takes a very talented individual. Those who have seen Cradle to Grave at the British Museum will understand the potency of a ‘pseudo data’ visualization, perhaps the ODI will find an analogue.

As much as anything, I hope they just manage to demonstrate the value of data. Not as art. Not as anything else, but as data. It is data, and transparency, and everything that implies which is beautiful, and that speaks for itself.

In the meantime I hope you like my first attempts at turning data into something a bit more visual and artistic and if you do spot a pattern, let me know! I’ll see if I can find those original scripts somewhere…

Proposal deadline for the ODI commission is 6pm Sunday 28th October 2012 – good luck to everyone who enters.

Note: It is recognized that the ODI are looking for a very different type of ‘data’ than I present with prime numbers here:

The work should, in some way, incorporate or reflect the ODI’s focus on getting value from data: social, economic, and/or environmental. Data can be real-time or static, collected from personal or local sensors (e.g. heart-ratemovementtransport systems) or online global sources (e.g. stock marketair pollutionpopulation demographics).

This in itself will return some incredibly interesting results… but will it be art..?

Edits: This post was edited 19 October 2012 to reflect the correct title of the ODI commission. Data-as-Culture. The link remains the same.

Additional 2018-01-22: Check out this blog on finding a prime number whose binary representation is a Giraffe, or T-Rex: