Tree Map: MoMA Dataset
A treemap visualizes the distribution of artist nationalities in the MoMA dataset, with each rectangle's area proportional to the count of artists from that country. Hovering over a rectangle displays a tooltip showing the nationality and its exact count, while the color scale assigns a distinct hue to each nationality. The visualization uses D3 v7 APIs including `d3.treemap`, `d3.hierarchy`, and `d3.scaleOrdinal` with `schemeTableau10`. The code processes an in-memory array of nationality counts, renders rectangles via SVG, and manages the tooltip through D3's `select` method. The layout is computed using the default treemap algorithm with a padding of 4 pixels.
AI-generated descriptionI made a tree map using the Nationality column in MoMA dataset, which reprsents artist's nationality. When you hover over an area, it displays a tooltip with the label and count.
Reference: https://d3-graph-gallery.com/graph/treemap_basic.html