← Back to projects

A million digits

View Project ↗

A few months back I was at the Art Gallery of South Australia. One of the artworks that caught my eye was Pi to one million decimal places by James Angus. It is a pretty simple artwork, displaying the million digits of pi, with each number color coded. It works well as a hung artwork because your perception of the work changes as you approach it. From afar it appears as a muted brown rectangle but as you get closer the colors emerge, and then finally you notice that it is made from numbers.

After seeing the artwork I thought it would be fun to make an interactive version where you can choose different colour palettes and visualise different irrational numbers.

There were a few interesting problems to overcome in making this, drawing a million numbers can be a bit taxing for the browser so I chose to render the numbers manually on canvas. That introduced some of its own problems because Firefox has some pretty strict limits on canvas size and rendering a million numbers at 5 pixels high plus padding works out to hundreds of thousands of pixels depending on your screen size. I was able to work around this by splitting the rendering across multiple canvasses. The code is far from optimal and definitely messy but this isn't something that needs to be maintained so I wasn't too worried about that.