Choropleth Map with Interactive Filtering
A choropleth map displays countries colored by economy group using an ordinal color scale, with a sidebar legend of clickable swatches. Clicking a legend item filters the map to highlight only countries in that category, dimming non-matching regions and adjusting opacity. The visualization uses D3 v5’s `geoPath`, `geoNaturalEarth1`, `scaleOrdinal`, and `schemeSpectral` for cartographic rendering and coloring, while the legend handles events via `on('click')`. Country data merges TopoJSON geometry with TSV attributes from the world-atlas package.