Using clustering to make a color scale

Posted to Statistics  |  Tags: ,  |  Nathan Yau

Choice of color scale can make a big difference in how the data reads. A careless choice might make the data appear skewed too far low or too far high, so you need to look at the data and decide what’s right for the context. But, sometimes you just gotta make a lot of charts or maps. Or, you just don’t feel like manually picking the colors.

David Schnurr describes a way to use clustering to pick the natural breaks in a more automatic fashion. The best part:

In an effort to make it easier for anyone to use this technique in data visualizations, I’ve ported this new algorithm to JavaScript and created a custom d3 scale called d3-scale-cluster. You can find d3-scale-cluster on Github and npm–give it a try and shoot me a tweet @dschnr with your thoughts!

More on GitHub.

And I await for someone to make an R package.

Favorites

Real Chart Rules to Follow

There are rules—usually for specific chart types meant to be read in a specific way—that you shouldn’t break. When they are, everyone loses. This is that small handful.

Top Brewery Road Trip, Routed Algorithmically

There are a lot of great craft breweries in the United States, but there is only so much time. This is the computed best way to get to the top rated breweries and how to maximize the beer tasting experience. Every journey begins with a single sip.

Life expectancy changes

The data goes back to 1960 and up to the most current estimates for 2009. Each line represents a country.

How We Spend Our Money, a Breakdown

We know spending changes when you have more money. Here’s by how much.