A few months ago, my colleague and fellow beer lover Chris Havens noticed an interesting fact: that Minnesota was among the nation’s leaders in craft brewery growth. Chris and I knew we had stumbled upon a great opportunity — we just didn’t know what it was.
Around the same time, FlowingData picked up on a great post on clustering 86 types of whiskey, which included a fantastic dataset that was begging to be visualized. I built a star plot generator in d3, which my future colleague Christopher Ingraham soon expanded into a beautiful visual representation of the whiskey. (Chris later found the source for the data — quite the tale.)
I showed Chris Havens, and we immediately saw the underpinnings for the graphic we finally published: Beer Me, Minnesota! With more than 50 breweries currently operating in Minnesota (and no indication of that trend soon reversing), we hoped to guide readers through the influx of local craft beer.
Great data visualization requires great data, and no such set existed for attributes of local craft beer. To ease compilation of the information, Chris and I built a Google Form to send to local brewers. We weren’t initially sure what we would be doing with the data, but many brewers were trusting enough to respond with information about their favorite brews. We had to be a bit cautious in forming questions, though, since the data would be self-reported by the brewers.
The math behind the matchmaker
Our matchmaker is surprisingly simple mathematically. When the user searches, the code uses a version of the distance formula to find the closest match.
In a two-dimensional world, the distance between two points is:
It’s easy to expand the distance formula to a generic world of
Of course, our beer world had five dimensions: IBUs, SRM, Aroma, ABV, and Body. Since these attributes had different ranges, we first had to normalize them. Otherwise, a 10-point difference in IBUs would mask a 0.10 difference in ABV, though the latter is more substantial.
Visualizing the data was simple with
d3.starPlot(), which I refined
over the course of the project. To introduce readers to this type of chart, we
live-visualized their attribute choices. On slider
change, I called the
It’s pretty simple, but to fun (and surprisingly helpful) effect. I leave building a national version as an exercise for the reader.