Day 30: Happy Pi Day!

Paige Smyth
2 min readMar 14, 2022

--

Today’s Visualization

Title: 961 Digits of Pi

Notes: This was inspired by Aqeel Anwar’s pi visualizations, but I wanted to try coding it myself! It’s also closer to data art than data visualization–hope you enjoy! Each digit is represented by a different color; even digits are hollow circles and odd digits are solid circles.

Tools: processing.py

Reflection

Happy pi day! I hope you’re celebrating with math, pie, or both 🥧 For today’s visualization, I created a colorful representation of pi that’s actually closer to data art than data visualization. I coded it used processing.py, a Python graphics library that allows you to draw both static and animated graphics. Processing was originally released with a Java-based syntax, but they’ve gradually released other programming interfaces, including JavaScript, Ruby, and Python.

This was my first time using the library, but in the end I wrote a working program to produce the visualization you see above! In essence, the program draws a circle for each digit of pi and assigns a color and fill style based on the digit. (Each digit (0–9) has a unique color, even digits are hollow circles, and odd digits are solid circles.) The circles are drawn along each row until they reach the edge of the window, when they switch to the next row; this continues until it reaches the indicated digit, which in the visualization above is 961. (I wanted a square :))

Writing the program and creating this viz wasn’t as easy as pi, but I learned a lot and had fun doing it! Hope you enjoy it!

Today’s Recommendation

The Art of Pi by Martin Krzywinski

I think this is a beautiful piece of art on its own, but it’s even more fascinating that it represents pi! The creators used lines to connect successive digits in pi (e.g., 1 to 4 represents the first ‘14,’ then 4 to 1, then 1 to 5), with each digit having its own arc of the circle. They have a whole page describing how they made it, along with some other pi projects, here.

Until tomorrow,
Paige

--

--