How would you visualize high-cardinality categorical relationships?

This tests dimensionality reduction when categories exceed roughly fifty levels. A strong answer proposes top-N aggregation with an other bucket and density or hierarchy plots like heatmaps or treemaps. A red flag is scrolling a bar chart or sampling rows.
WHAT THIS TESTS: The interviewer wants to see if you understand visual encoding limits and can move beyond default bar charts when cardinality explodes. With zip codes or product IDs, a standard bar plot becomes unreadable because human working memory cannot track thousands of discrete positions. The question probes your knowledge of information reduction, hierarchical aggregation, and alternative visual forms that trade individual identity for pattern detection.
A GOOD ANSWER COVERS: First, information reduction techniques. You should mention filtering to top-N categories by frequency or a numeric metric and bundling the remainder into an other bucket. You can also group by a higher-level hierarchy such as city or product category to collapse cardinality. Second, alternative encodings that do not require one mark per category. For a single numeric variable across many categories, lollipop charts or dot plots reduce ink and improve readability. For part-to-whole relationships, treemaps or circular packing use nested area to show hierarchy. For relationships between a high-cardinality category and a numeric distribution, violin plots, box plots, or ridge lines replace hundreds of bars with density shapes. For two categorical variables, a heatmap with color intensity handles far more combinations than grouped bars. Third, interactivity as a supplement, not a crutch, such as searchable tooltips or drill-down from summary to detail.
COMMON WRONG ANSWERS: A junior answer suggests rotating the bar chart or using a horizontal layout, which does not solve the fundamental overplotting problem. Another red flag is proposing to sample the data randomly, because that hides long-tail behavior and outliers that are often the most actionable insights. Simply using a smaller font or scrolling is also unacceptable at a senior level because it offloads cognitive load to the reader instead of the designer.
LIKELY FOLLOW-UPS: The interviewer may ask how you would handle a third variable, which opens discussion about faceting small multiples or using color and size channels in a scatter plot. They might also ask how you would communicate the missingness of the other bucket, leading to a discussion of Pareto charts or cumulative percentage lines. Finally, they could probe scalability by asking what you would do with millions of distinct IDs, which pushes toward database-level pre-aggregation or switching to entirely different paradigms like search interfaces rather than static plots.
ONE CONCRETE EXAMPLE: Suppose you have one million transactions across twelve thousand product IDs and want to show revenue per product. A strong approach is to create a Pareto chart of the top fifty products by revenue, grouping the rest into other, and overlay a cumulative percentage line so stakeholders see that the top fifty drive eighty percent of sales. For the full distribution, you render a violin plot of log revenue by product category instead of by individual product, preserving the shape of the long tail without twelve thousand bars.
Source: data-to-viz.com
Read the original → data-to-viz.com
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.