block by micahstubbs 9c2397c1da11c7b5d331653bcd475c1f

world map 08 ckmeans cluster max breaks

Full Screen

in this iteration, we use the ckmeans algorithm from the simple-statistics package to cluster our data. we pick the maximum 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.

🎩 @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

index.html

d3-tip.js

jenks.js

world_population.tsv