https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUur0kdfW12QazkJUeb_QLcmRG7T6lXxJuNAC6EUdP9YJCPbJB93j4ZZmT4vLhyphenhyphenaTQOtmCjpeVgqZzpuZJHx2tfq623xnOaPLjvAEfrwFIe4nHXfj7gxlYYQOL9PK6L1SBaphYY0nHyds/s640/browser-ww-quarterly-20083-20134-other.png

Punchcard is a GitHub-sylte punchcard image generator, it plots a CSV data using Pycairo to render the punchcard graph.

Using the data source from StatCounter1 about quarterly web browser market shares, from Q3 2008 to Q4 2013, for a chart as below would render a punchcard like the one on the right.

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmh9hAeaOuvnRKQp5Z0A60pTtotNPhVeygPC3xDbKuleTcuZ96un70PWNjDjNEZI6_8dI9D6NbPtXgN_K91Sn8k_xKbC3VJyyj1ayqEvvhA_qFGiCO4rPhIbW9tVh-5Kz4_gjdreuPwWg/s288/StatCounter-browser-ww-quarterly-20083-20134.jpg

There are two ways to use it, a simple command-line interface and programmically as library.

Its command-line doesn’t really have much flexibility other than setting a chart title. If you want to change fonts, colors, grayscale values, sizes, or set diagonal text, you will need to do it programmically.

The command-line syntax is:


$ python punchcard.py input.csv output.png [title]

And programmically:


punchcard(png_path, row_labels, col_labels, data, **kwds)

You could supply key-value pairs of settings for the chart options. But overall, by default, the output quality and result is very good, you probably don’t need those customizations.

Last time that I’ve made a GitHub-like punchcard graph is for blogging times and this generalized version using D3. But are hours-by-days style, not like this library, which only requires a 2-dimension data.

This Python Punchcard library i written in Python 2 by Michael Fogleman, licensed under the MIT License.

[1]http://gs.statcounter.com/#desktop-browser-ww-quarterly-200803-201304 doesn’t work properly anymore. (2015-07-17T07:19:19Z)