block by hugolpz b001ccced07c1724c5a9ea0680308ad3

world map 09 ckmeans cluster min breaks

Full Screen

in this iteration, we use the ckmeans algorithm from the simple-statistics package to cluster our data. we pick the minimum value of each cluster as a break. we then use these breaks with a quantile scale to map values in the data to colors on the choropleth map.

this is method is my current favorite way to create breaks, or color thresholds, for a choropleth map.

🎩 @Elijah_Meeks for the idea to try the ckmeans algorithm, as it seems to be the new hotness in the choropleth map breaks scene

a further 🙏 to @recifs for talking through where in the ckmeans clusters its reasonable to pick breaks from.
tl;dr any number between max(class n) and min(class n+1) is OK

do check out the other examples in this world map series:

world map 00 original example
world map 01 fix tooltip value
world map 02 d3 v4
world map 03 es2015 + update code style
world map 04 manual breaks + threshold scale
world map 05 linear breaks + quantize scale
world map 06 linear breaks + quantiles scale
world map 07 Jenks natural breaks
world map 08 ckmeans cluster max breaks
world map 09 ckmeans cluster min breaks