Tag Archives: d3

3-Letter Word Scatterplot

three_letters

Here‘s a D3-powered scatterplot showing the distribution of 3-letter words, at least, according to wordfind.com.

Instructions are simple: chose the starting letter in the dropdown list. Then, find individual words by the second letter (y-axis) and third letter (x-axis). Mouseover the point to convince yourself.

Bracket Challenge Scenarios

bracketI find myself in an NHL playoff pool. The rules are simple: pick the winner of each round. We’ve been going since the beginning of the playoffs, so points have been accumulating thus far. Suffice it to say, the remaining rounds are worth 50 points for each conference final and 100 points for picking the Stanley Cup winner, so there is still some jockeying to be done.

If you haven’t been following, the conference finals are well underway, meaning there are 4 teams left (Chicago, Anaheim, Tampa Bay, and New York). You can also deduce that there are now only eight scenarios remaining for how the rounds can shake out.

This graph removes all mystery as to how we will each fair, for each scenario.

Refractometer: ABV Calculator

Image

I got a mysterious package in the mail yesterday – by the time I figured out that it was a Christmas present from my brother, it was too late.

Turns out the gift was a refractometer, a device used to measure an index of refraction, or how light gets bent going through another substance. Few people outside laboratories have much use for such a thing, but along the way some science-savvy beer brewer realized that you could measure the amount of dissolved sugar, and thus the amount of potential alcohol, in freshly brewed beer. By comparing the amount of sugar at the beginning and end of fermentation, you can infer the amount of alcohol by volume (ABV) in the finished beer.

Most homebrewers use a hydrometer in a similar manner, but this requires several chances of contamination (each time the wine-thief is filled, often several times) and wastes a good deal of beer along the way (about 100ml for each measurement). Refractometer measurements use a mere couple of drops which are collected only once per measurement.

Unfortunately, once alcohol is present in the liquid (i.e. any time after the initial measurement), it messes with the refraction measurement and a mathematical correction must be applied in order to compare the two samples. Using formulas from Northern Brewer, Primetab, Realbeer, I made an interactive calculator for calculating ABV from initial and final refractometer readings (in Brix units), and you can find it here. Drag the bars up and down to match your initial and final measurements.

Notes: there are tons of other online refractometer calculators, and I’ve seen some that use different formulas (or at least different coefficients), so beware. Also, if you’ve got Matlab, my brother made a library for charting and doing the calculations for yourself (blog post here).

D3 Ski Trip Player: Update (Compass Rose)

Image

I’ve added a couple pieces of “functionality” (not obviously useful) to my previously posted Ski Trip Player (here and here, and now HERE). There is now a button on the map portion that allows the user to switch between projections (1. Mercator and 2. Lambert Azimuthal Equal Area). The entire map switches and the little ski man keeps moving along. The trickier part was creating the compass rose and having it rotate within the map boundary, which it does. Take a look at the source code to see how I do it – I’m positive there is a more efficient way to do it. Let me know!

D3 Ski Trip Player: Update

Image

I had some time to kill waiting for a Python script to wrap itself up, so I worked on my D3-powered Ski Trip Player. I focused on the elevation profile, adding: 1) diverging color scale to indicate climbing/sliding areas, 2) horizon line to demarcate the travel path, and 3) legend. I suspect I’ve compromised looks for function in this iteration, but it was instructive nonetheless.

D3 Ski Trip Player

Image

It’s official – I like D3. Here‘s an example using XML data from one of my ski excursions (collected by GPS watch, downloaded from Garmin Connect), and trail data from a Google Fusion table (run through ft2JSON to get a JSON response). There’s an animated elevation profile with associated animated map (over 1700 points animated!). It works well, but as always, please feel free to take a look at the code and see if you can make it more efficient.

GPS watch → CSV → D3 (pt. 2)

Image

I continued learning D3 today, adding (here) to my previous post displaying my winter activities. The major addition is an average heart rate line for each activity, drawing heavily on this D3 example. I found it pretty tricky to get the data filtering to work properly, but this seemed to do the trick – see the source code. I’m definitely still learning, so please feel free to reply with suggestions for optimizing the code.