The map shows official languages (at a national level, sorry regional official languages) by country. Though, not all countries have official languages, so I've used a bit of discretion. Also, in the case of Bolivia, with a multitude of official languages, some of which may be extinct, I've shown some of the more major languages
The block adds a bit to the pattern module with the uncreatively named autoStripes function. This is a slight evolution from this bl.ock meant to automate the assignment of stripes and solids.
The patterner takes datums, one at at time, and determines if the current datum matches any previous datums. If so it returns:
If the datum does not match previous datums, then it returns:
Color usage is consistent - whether stripes or solids.
Also, patterns aren't duplicated, to reduce the potential for extra nodes in the DOM. However, there may be some merit in allowing duplication. For example, to allow for mouseover effects.
This is just an idea at the moment - I hope to have something a little more polished and complete soon.
https://d3js.org/d3.v4.min.js
https://unpkg.com/topojson-client@3