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.
Pre-processing
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:
000000000010
000000000011
000000000101
000000000111
000000001011…
110111110011
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
Link (Right-click ‘Save link as…’)
Half the effect: 250 primes
Link (Right-click ‘Save link as…’)
Tiled
Link (Right-click ‘Save link as…’)
1% of the effect: 5 primes
NOTE: I need to investigate this image again, 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…
Obligatory image with Insta filter
Art…
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…
ODI submissions
The deadline for proposals for the ODI commission is 6pm Sunday 28th October 2012 – good luck to everyone who enters.
It is recognized that the ODI are looking for a very different type of ‘data’ than I present with prime numbers here, their hope:
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-rate, movement, transport systems) or online global sources (e.g. stock market, air pollution, population demographics).
This in itself will return some incredibly interesting results… but what properties will it need to satisfy to be considered art?
Addendum
2012-10-19: This post was edited 19 October 2012 to reflect the correct title of the ODI commission. Data-as-Culture. The link remains the same.
2025-05-10: This post was edited on 10 March 2025 to improve its appearance on ActivityPub instances and to improve other visual elements. Some text was improved so that it read, slightly, better.
Prime T-Rex
2018-01-22: Check out Shabda Raaj’s (Agiliq) blog on finding a prime number whose binary representation is a T-Rex or Giraffe:
You Never Can Divide Outputs Of The Equation (100X^2)+(160X)+(59) To Numbers (3,13,23,33,…) Or Numbers (7,17,27,37,47,57,…)
The All Outputs This Equation Are Prime Numbers Or Just Divide To Numbers (11,31,41,…) And Numbers (19,29,59,79,…)
With Selection Special Inputs To This Equation , Always We Can Have Prime Numbers In Outputs That For Sample If X is :
(2^27) or (2^97) or (2^267) or (2^287) or (2^797) or (2^1287) or (2^2817) or … Then All Outputs Is Prime Numbers.
Please Numbers To Note (27 , 287 , 2817 , …)
For download the zip file tester software and this article , visit : http://www.nerset.com/3/gharbalgar/preview.png