M08 · Data analysis, curation, and visualization08-0433 min read
Lesson 56 of 106 · Module 9 of 14 · Week 4
Threads:The measurement threadThe control thread
Choosing the Right Chart: Histogram, Box Plot, Scatter, Bar, Heatmap, Line
Chart type is determined by the question, not by taste: histogram for the distribution of one variable, box plot for spread and outliers (especially across groups), scatter for the relationship between two variables, bar for comparison across categories, heatmap for a matrix or correlation structure, line for a trend over time. Memorise that six-way mapping — it is directly reported exam content. Then learn the consequence that matters more: an aggregated chart is structurally incapable of showing group-level harm, which makes disaggregated visualization a fairness instrument rather than a presentation skill.
What choosing the right chart means
Choosing a chart type means selecting the visual encoding whose geometry matches the question being asked, so that the answer is readable from the shape rather than from the caption. A chart is not a decoration on top of a number; it is a claim, and the chart type determines which claim you are able to make.
The six canonical types and their one-line identities, which is the table to hold in memory:
| Chart | Answers the question | Shows | Data it needs |
|---|---|---|---|
| Histogram | "What does the distribution of this variable look like?" | shape, centre, spread, skew, modality | one continuous variable |
| Box plot | "How spread out is it, and where are the outliers?" | median, quartiles, IQR, outliers — and comparison across groups | one continuous variable, optionally split by a category |
| Scatter plot | "Are these two variables related?" | correlation, clusters, nonlinearity, bivariate outliers | two continuous variables |
| Bar chart | "How do categories compare on this value?" | magnitude comparison across discrete groups | one categorical + one numeric |
| Heatmap | "What is the structure of this matrix?" | correlation matrices, confusion matrices, two-way patterns | a 2-D grid of values |
| Line chart | "How is this changing over time?" | trend, seasonality, change points | an ordered variable (usually time) + a numeric |
The pairs most often confused, stated as discriminators:
- Histogram vs bar chart. A histogram bins a continuous variable and its bars touch, because the x-axis is a number line; a bar chart compares categories and its bars are separated, because there is no space between "Billing" and "Refunds." Getting this wrong is the single most common chart-type error, and the exam tests it.
- Histogram vs box plot. Both describe one variable's distribution. The histogram shows shape — you can see bimodality, which a box plot hides completely. The box plot shows summary and outliers compactly, and its superpower is putting many groups side by side. Use the histogram to understand one distribution; use box plots to compare ten.
- Scatter vs line. A scatter shows relationship between two variables with no implied order; a line implies that consecutive points are connected in sequence, which is only meaningful when the x-axis is ordered. Connecting scatter points with a line asserts a continuity you have not measured.
- Heatmap vs scatter. Both can show relationship. Scatter shows the relationship between two variables in detail; a correlation heatmap shows the pairwise relationships among many variables at a glance, at the cost of all detail — it gives you one number per pair and hides everything the scatter would have revealed.
How chart selection works: from question to geometry
L1 — Intuition: count your variables and their types
The selection procedure is nearly mechanical. Ask two questions:
- How many variables am I showing? One, two, or many.
- What are their types? Continuous, categorical, or ordered/temporal.
That produces a lookup:
| Variables | Types | Chart |
|---|---|---|
| 1 | continuous | histogram (shape) or box plot (summary + outliers) |
| 1 | categorical | bar chart of counts |
| 2 | continuous + continuous | scatter plot |
| 2 | categorical + continuous | bar chart, or box plot per group if you want the distribution not just the mean |
| 2 | time + continuous | line chart |
| 2 | categorical + categorical | heatmap of counts, or grouped bars |
| many | continuous | correlation heatmap, or a scatter matrix |
| 2 | categorical + continuous, and you care about subgroups | box plot by group or small multiples — see section 3 |
Notice the fourth row. "Categorical + continuous" defaults to a bar chart of the mean, and that default is where most misleading charts in the world come from, because a bar of the mean discards the distribution entirely. When the distribution is the point — as it always is for text lengths, latencies, and per-user metrics — the box plot per group is the honest choice.
L2 — What each chart actually encodes, and its failure mode
Histogram. Bins the range into intervals and shows the count in each. The one parameter is bin width, and it is not cosmetic: too few bins hides structure (a bimodal distribution can look unimodal), too many turns the chart into noise. Always try two or three bin widths before believing a shape. For heavy-tailed data — document token lengths, request latencies, cost per query — a linear x-axis compresses the entire body of the distribution into the first bin; a log-scaled x-axis is often the only readable option, and it must be labelled as such.
Box plot. Encodes five numbers: median, first and third quartiles (the box), whiskers (conventionally 1.5 × IQR), and individual outlier points beyond them. Its strength is density of comparison — twenty groups side by side, each honestly summarised. Its weakness is that it cannot show modality: a perfectly bimodal distribution and a uniform one can produce identical box plots. Its other weakness is that it hides sample size, so a box computed from 6 points looks exactly as authoritative as one from 60,000; annotate n, always. When both shape and comparison matter, a violin plot or a strip/jitter plot overlaid on the box recovers what the box discards.
Scatter plot. Encodes two continuous variables as position. It is the only common chart that shows nonlinearity, clusters, and bivariate outliers — points unremarkable in either variable alone but impossible in combination. Failure modes: overplotting, where tens of thousands of points saturate into a solid blob and hide density (fix with transparency, hexbin, or a 2-D density plot), and the temptation to add a trendline, which imposes a linear model on a relationship you have not verified is linear.
Bar chart. Encodes magnitude as length. Because length is the encoding, the y-axis must start at zero — truncating the axis multiplies the apparent difference by an arbitrary factor, and this is the canonical example of axis dishonesty. (Line charts are the exception: they encode change, so a non-zero baseline is legitimate there, provided it is labelled.) Sort bars by value rather than alphabetically unless the category order is meaningful; the sort is doing analytical work.
Heatmap. Encodes a matrix as colour intensity. Two workhorse uses in ML: the correlation matrix (which pairs of features move together) and the confusion matrix (which classes get mistaken for which). Failure modes are all about colour: use a diverging palette centred on zero for correlations, because +0.8 and −0.8 are opposite in meaning and a sequential palette makes them look merely different in degree; use a sequential palette for counts, which have no meaningful midpoint. Rainbow palettes create boundaries where the data has none and are not perceptually uniform. And never rely on colour alone as the only channel — annotate the cells with values where the grid is small enough, because a meaningful fraction of readers have colour-vision deficiency.
Line chart. Encodes an ordered sequence, and asserts by its geometry that the space between points is continuous. Only use it when that assertion is true. Two ML-specific instances are worth naming because they appear in the official material's orbit: learning curves (loss and metric versus epoch, for training and validation together — the diagnosis of overfitting per 12-03) and metric-versus-time monitoring charts (12-14).
L3 — Aggregation, disaggregation, and Simpson's paradox
Here is the argument that makes this lesson more than a lookup table.
Every chart aggregates. A histogram aggregates individuals into bins; a bar chart aggregates a group into one number; a line chart aggregates a population into one series. Aggregation is the mechanism by which a chart becomes readable, and it is also the mechanism by which a chart becomes incapable of showing certain things. A chart cannot show a pattern along a dimension it has aggregated away. This is not a limitation of skill or effort. It is geometry.
The consequence for fairness is direct and inescapable. If your model's accuracy is 94% overall and 62% for one user group, an aggregate accuracy bar chart will show one bar at 94%. Not a misleading bar — a correct bar, faithfully computed, that is structurally incapable of representing the 62%. No amount of care in drawing that chart recovers the finding, because the group dimension was collapsed before the chart existed. The only fix is upstream of the chart: disaggregate. Compute and plot the metric per group.
That is why honest visualization is a fairness instrument. Disaggregated visualization is the mechanism by which group-level harm becomes visible at all, and a review process that accepts aggregate charts has, by construction, no way to detect the harms it is meant to prevent. NVIDIA's trustworthy-AI framing names nondiscrimination — minimising bias so people have equal opportunity to benefit — as a pillar [NVIDIA-DOC], and the operational form of that commitment in the analysis layer is: never report an aggregate metric without its disaggregation. Lesson 13-04 takes the measurement side further.
Simpson's paradox is the extreme case, and it is named on this exam's content list. It is the phenomenon where a trend present in every subgroup reverses when the subgroups are combined. A constructed illustration, with numbers chosen to make the arithmetic visible:
| Group | Model A | Model B |
|---|---|---|
| Short queries | 90/100 = 90% | 190/200 = 95% |
| Long queries | 40/200 = 20% | 12/100 = 12% |
| Combined | 130/300 = 43.3% | 202/300 = 67.3% |
Model B wins overall by 24 points. Model A is better on long queries (20% vs 12%) and worse on short ones. The reversal is driven by the mix: B was evaluated mostly on the easy subgroup. Whether the aggregate is the right number to report depends entirely on whether your production traffic mix matches the evaluation mix — and if it does not, the aggregate is a statement about your evaluation set's composition rather than about the models. The chart that would have shown this is a grouped bar chart or small multiples split by query length. The chart that hides it is a single bar per model. Same data, two charts, opposite conclusions, and only one of them is honest about what it does not know.
The general antidote is small multiples: the same chart repeated once per group, on shared axes. Shared axes are the essential detail — the comparison only works if the scales are identical, and per-panel autoscaling silently destroys it.
Correlation, causation, and the two correlation coefficients
Objective 2.5 asks about "relationships and trends or any factors that could affect the results," and three named items live here.
Correlation is not causation. A scatter plot showing that two variables move together is consistent with A causing B, B causing A, a confounder C causing both, selection effects, or coincidence. A spurious correlation is a statistical association with no causal link — abundant in high-dimensional data because the more variable pairs you test, the more strong-looking correlations arise by chance alone. The practical discipline: a correlation supports a hypothesis, never a conclusion, and only an intervention (an A/B test, per 10-03) supports a causal claim.
Pearson vs Spearman, the second explicitly-named item:
| Pearson correlation (r) | Spearman correlation (ρ) | |
|---|---|---|
| Measures | strength of the linear relationship | strength of the monotonic relationship |
| Computed on | the raw values | the ranks of the values |
| Assumes | roughly linear relationship, continuous data | only that the variables are ordinal or better |
| Sensitive to outliers | yes, strongly | much less so — an extreme value is just the top rank |
| Detects a curved but always-increasing relationship | poorly (r can be well below 1) | well (ρ can be 1.0) |
| Use when | you believe the relationship is linear and outliers are controlled | data is ordinal, skewed, or outlier-prone, or the relationship is monotonic but curved |
The discriminator: Pearson is about values and linearity; Spearman is about ranks and monotonicity. For the skewed, heavy-tailed quantities that dominate LLM work — token lengths, latencies, costs — Spearman is frequently the more honest choice, and reporting both when they disagree substantially is itself a finding: a large Pearson–Spearman gap says either outliers or nonlinearity is driving your result.
The rule that ties this section to the previous one: always plot the scatter before trusting the coefficient. Two variables can share a correlation coefficient of 0.8 with entirely different underlying shapes, and a coefficient with no scatter plot behind it is a number nobody has checked.
Histogram vs box plot vs scatter vs bar vs heatmap vs line: the selection table
The exam-critical table, read in the direction the exam asks: purpose first.
| If the question is… | Use | Not | Because |
|---|---|---|---|
| What is the distribution / shape of this variable? | histogram | bar chart | bars must touch on a continuous axis; a bar chart implies discrete categories |
| Is this variable skewed or bimodal? | histogram | box plot | a box plot cannot show modality at all |
| Where are the outliers, and how spread out is it? | box plot | histogram | outliers are individually marked and quartiles are explicit |
| How do these 12 groups' distributions compare? | box plots side by side (or violins) | 12 histograms | side-by-side boxes are comparable at a glance on shared axes |
| Are these two continuous variables related? | scatter plot | line chart | a line asserts sequential continuity that a relationship does not have |
| Is there a nonlinearity or a cluster in this relationship? | scatter plot | correlation coefficient alone | the coefficient collapses shape into one number |
| Which category has the highest value? | bar chart, sorted, zero-baselined | pie chart | length comparison beats angle comparison; pies fail past ~4 slices |
| How did this metric change over the last 90 days? | line chart | bar chart | trend and change points are the point; bars fragment the sequence |
| Which features are correlated with which? | correlation heatmap, diverging palette | many scatter plots | one glance across all pairs; use scatters to follow up on what it flags |
| Which classes does the model confuse? | confusion-matrix heatmap | accuracy number | the structure of the errors is the finding |
| Is the model overfitting? | line chart of train and validation loss vs epoch | final metric | the divergence between the two curves is the diagnosis (12-03) |
| Does the model perform equally well for every group? | disaggregated bars or small multiples, one per group | any aggregate chart | the aggregate is structurally incapable of showing it |
| What share of the whole is each part? | stacked bar or sorted bar | pie chart | acceptable for a small number of parts; a sorted bar is usually still clearer |
| How are two categorical variables jointly distributed? | heatmap of counts | two separate bar charts | the interaction is the point and separate charts cannot show it |
And a compact form worth committing to memory verbatim, because it is the shape the reported exam item takes:
histogram = distribution · box plot = spread and outliers · scatter = relationship · bar = comparison · heatmap = matrix / correlation · line = trend
Worked example: visualising a support-assistant evaluation
All numbers below are constructed for illustration. They continue the corpus from 08-03 so the charts have something real-feeling to describe.
You have evaluated a support assistant on 1,200 queries. You hold: token length per query, response latency, an accuracy label per item, a query-category label, a user-language label, and a per-item groundedness score. Six quantities, and each wants a different chart.
Chart 1 — the distribution of query token lengths. Histogram, log x-axis. The linear-axis version put 84% of queries in the first bin and stretched a nearly empty tail across the remaining width; unreadable. On a log axis the distribution is visibly bimodal: a mode near 12 tokens (one-line questions) and a second near 180 (pasted error logs). That bimodality is the finding, and it is the finding a box plot would have destroyed — the box plot of the same data shows median 31, IQR 14–96, and a smooth-looking single population. Two modes means two user behaviours, which means two prompt strategies. Histogram earned its place by showing shape.
Chart 2 — latency spread, and outliers. Box plot, split by category. Six categories side by side, n annotated on each.
| Category | n | Median latency (ms) | IQR | Outliers above whisker |
|---|---|---|---|---|
| Billing | 324 | 780 | 610–1,010 | 4 |
| Technical | 612 | 1,240 | 890–2,100 | 31 |
| Account | 180 | 810 | 640–1,060 | 2 |
| Refunds | 24 | 1,910 | 1,320–3,400 | 5 |
| Other | 60 | 900 | 700–1,180 | 3 |
Two findings the aggregate median (1,050 ms) contains but cannot express. First, Technical has both the highest median and a wide IQR — variance, not just slowness. Second, Refunds has a median of 1,910 ms on n=24, and the annotated n is what stops you over-reading it: with 24 points that median has wide uncertainty, and the honest statement is "possibly the slowest category, sample too small to be sure." An unannotated box plot would have presented it with the same confidence as the n=612 box. Annotate n.
Chart 3 — does length drive latency? Scatter, with transparency. 1,200 points, token length (log) against latency (log). The cloud shows a clear positive relationship and a distinct second cluster: about 40 points at short lengths and very high latency. Those are cache misses on cold retrieval — invisible in any summary statistic, and the scatter's whole justification. Pearson r on the raw values is 0.31; Spearman ρ is 0.68. The gap between them is itself the finding: the relationship is monotonic but strongly nonlinear, and the heavy right tail drags Pearson down. Reporting r = 0.31 alone would have understated a real dependency by half.
Chart 4 — accuracy by category. Bar chart, sorted, zero-baselined. Aggregate accuracy is 86.4%. Per category: Technical 91%, Billing 88%, Account 84%, Other 71%, Refunds 42%. The single aggregate bar at 86.4% would have been correct and useless. The sorted bar chart puts Refunds at the end of the row where it cannot be missed, and it is the compliance-sensitive category — the same finding that surfaced as class imbalance in 08-02, now visible rather than inferred.
Chart 5 — where the errors concentrate. Confusion-matrix heatmap, sequential palette, cells annotated. The route classifier's errors are not spread evenly: 68% of all misroutes are Account→Other or Other→Account. One boundary, one guideline to rewrite. A per-class accuracy bar chart would have told you both classes were weak; only the heatmap tells you they are weak at each other, which is the actionable form.
Chart 6 — the fairness chart. Disaggregated accuracy by user language, small multiples across category. Aggregate accuracy 86.4%; English 88.9%; Spanish 61.2%, on n=94.
This is the lesson's argument in one number. Charts 1 through 5 are all competent and none of them can show this. Chart 4 aggregated over language. Chart 2 aggregated over language. The overall figure of 86.4% is arithmetically correct and describes a system that works substantially worse for one in forty of its users. The finding required a decision to split by a dimension nobody asked about — and that decision is the fairness instrument, not the chart. The corpus profile in 08-03 is what made it thinkable: it found 2.2% Spanish content in a corpus everyone described as English.
The small-multiples version, on shared axes, goes further: Spanish accuracy is roughly comparable to English for Billing (81% vs 88%) and collapses for Technical (44% vs 92%). So it is not a uniform language penalty; it is a retrieval gap concentrated in the technical corpus, which is a different and much more fixable problem than "the model is bad at Spanish." The disaggregation did not just detect harm — it localised the cause.
Summary of chart-to-finding: histogram found bimodal user behaviour; box plots found variance and a too-small sample; scatter found a hidden cluster and a Pearson/Spearman gap; bars found a failing category; heatmap found the one confusable class pair; disaggregation found and then localised a group-level harm. Six questions, six chart types, and the sixth is the one a review process must require.
When to reach for each chart, and when a chart is the wrong output
| Situation | Reach for | Avoid | Note |
|---|---|---|---|
| Profiling a new corpus's length distribution | histogram, log x-axis | linear-axis histogram | heavy tails make linear axes unreadable |
| Comparing latency across many services | box plots, n annotated | bar chart of means | means hide the tail that users experience |
| Reporting p95 latency to stakeholders | a labelled number plus a box plot | a mean | percentiles are the operative statistic (12-10) |
| Screening 40 features for relationships | correlation heatmap, diverging palette | 780 scatter plots | heatmap to triage, scatter to confirm |
| Confirming a relationship flagged by the heatmap | scatter plot | trusting the coefficient | shape and outliers only appear in the scatter |
| Showing improvement across model versions | grouped or sorted bar, zero baseline | truncated-axis bar | truncation is the canonical dishonest chart |
| Diagnosing a training run | line chart, train and validation together | final-metric table | the divergence is the diagnosis |
| Reporting fairness or subgroup performance | disaggregated bars / small multiples, shared axes, n shown | any aggregate | aggregates cannot represent subgroup gaps |
| Showing composition of 3 parts | sorted bar or stacked bar | pie chart | length beats angle; pies fail past ~4 slices |
| Two variables, 500,000 points | hexbin or 2-D density | raw scatter | overplotting saturates and hides density |
| A single number is the whole finding | no chart — write the number in a sentence | a chart with one bar | a one-bar chart is decoration and dilutes the report |
| Precise values must be looked up and compared | a table | any chart | tables win when reading exact values is the task |
| The audience is non-technical and the claim is causal | a chart plus an explicit statement of what the data cannot establish | a chart implying causation | see 13-06 on explaining in non-technical language |
The last three rows are the ones worth internalising, because the professional instinct is to chart everything. A chart earns its place by making a comparison faster than prose or a table would. One number is a sentence. Ten precise values people need to look up individually are a table. Trends, distributions, relationships, and matrices are charts.
Why chart selection and disaggregated visualization are on the NCA-GENL exam
Objectives served. 2.4 "Create graphs, charts, or other visualizations to convey the results of data analysis using specialized software" is the direct one — note "convey," which frames visualization as communication rather than exploration. 2.5 "Identify relationships and trends or any factors that could affect the results of research" carries correlation vs causation, Pearson vs Spearman, Simpson's paradox, spurious correlation, seasonality, and drift. 2.1 / 1.2 on extracting insights from large datasets includes "data visualization" by name. And in the Trustworthy AI domain, 5.4 "describe how to minimize bias in AI systems" is where the disaggregation argument lands [OFFICIAL]. The Experimentation domain's printed objectives 3.4 / 3.5 duplicate 2.4 / 2.5 verbatim in the official PDF, which means the same visualization material is claimed by two domains — a documented source defect, and one that raises rather than lowers this material's expected question count.
Calibration. [FIELD] priority tiers put visualization at Tier 3, but the chart-type-to-purpose mapping was flagged as a gap worth closing explicitly because it appears in question form [FIELD]. The reconciliation: do not study visualization theory deeply, but do memorise the six-way mapping cold, because it is a fast recognition item and the exam gives you roughly 60–70 seconds per question. This is one of the cheapest sets of marks available in the whole blueprint.
Question phrasings to expect
- "Which chart type is most appropriate for displaying the distribution of a continuous variable?" → histogram.
- "Which visualization best displays the spread and outliers of a dataset?" → box plot.
- "A data scientist wants to examine the relationship between two continuous variables. Which chart?" → scatter plot.
- "Which chart is best for comparing a metric across categories?" → bar chart.
- "Which visualization is best for displaying a correlation matrix?" → heatmap.
- "Which chart best shows a metric's trend over time?" → line chart.
- "What is the difference between a histogram and a bar chart?" → histogram bins a continuous variable (bars touch); bar chart compares discrete categories (bars separated).
- "Two variables have a correlation of 0.85. What can be concluded?" → that they are associated; not that one causes the other.
- "Which correlation coefficient is appropriate for a monotonic but nonlinear relationship, or for outlier-prone data?" → Spearman (rank-based); Pearson measures linear association on raw values.
- "A trend visible in every subgroup reverses when the data is combined. What is this called?" → Simpson's paradox.
- "A model reports 94% aggregate accuracy but a user group reports persistent failures. What visualization would reveal the problem?" → disaggregated / per-group performance charts; the aggregate cannot show it.
- "Which practice makes a bar chart misleading?" → truncating the y-axis so it does not start at zero.
Distractor families
| Distractor family | Looks like | Why it is wrong |
|---|---|---|
| Bar chart offered for a distribution | "use a bar chart to show the distribution of response times" | bar charts compare categories; a continuous distribution needs a histogram |
| Pie chart offered for comparison | "use a pie chart to compare accuracy across five models" | angle comparison is worse than length; pies degrade past ~4 slices |
| Line chart for an unordered relationship | "connect the points to show the relationship" | a line asserts sequential continuity the data does not have |
| Correlation read as causation | "the chart shows that longer prompts cause higher latency" | association only; a confounder or reverse causation is equally consistent |
| Pearson as the default coefficient | offered for skewed or ordinal data | Pearson assumes linearity and is outlier-sensitive; Spearman handles ranks |
| Aggregate metric offered as sufficient | "report overall accuracy to demonstrate fairness" | structurally incapable of showing subgroup harm |
| Truncated axis defended as focus | "start the y-axis at 80% to make the difference visible" | on a length encoding this multiplies the apparent effect arbitrarily |
| Rainbow palette for a correlation heatmap | "use a rainbow colormap for maximum contrast" | not perceptually uniform, invents boundaries; correlations need a diverging palette centred at zero |
| Box plot offered to show modality | "the box plot shows the data is bimodal" | a box plot cannot show modality; that is a histogram's job |
| More charts as more rigour | a dashboard of 20 charts as the deliverable | a chart earns its place by making one comparison faster; the rest dilute |
Common mistakes with charts and visualization
| # | Symptom | Cause | Fix |
|---|---|---|---|
| 1 | A distribution looks unimodal and smooth; the data is not | bin width too wide, or a box plot used instead of a histogram | try several bin widths; use a histogram when shape matters |
| 2 | The whole distribution crushes into the first bin | linear axis on heavy-tailed data | log-scale the axis and label it as logged |
| 3 | A small difference looks dramatic | y-axis truncated on a bar chart | zero-baseline every length encoding; label any non-zero baseline on a line chart |
| 4 | A scatter is a solid black blob | overplotting | transparency, hexbin, or 2-D density; subsample as a last resort |
| 5 | Two groups look equally reliable but one has 12 points | sample size not encoded | annotate n on every group; consider marker size or confidence intervals |
| 6 | A correlation heatmap makes −0.9 and +0.9 look similar | sequential palette on signed data | diverging palette centred at zero; annotate cells when the grid is small |
| 7 | A model chosen on aggregate scores loses in production | Simpson's paradox — the evaluation mix differed from the traffic mix | disaggregate by the mix variable; compare like subgroups |
| 8 | A fairness review passes and users report a group-level failure | only aggregate charts were reviewed | require disaggregated views as a review artefact, not an option |
| 9 | Small multiples appear to show no difference between groups | per-panel autoscaled axes | shared axes across every panel, always |
| 10 | A chart is beautiful and nobody can say what it shows | no question was stated before charting | write the question in the title; if the title is not a claim, the chart has no job |
| 11 | Colour-coded categories are unreadable for some readers | colour used as the only channel | add shape, direct labels, or annotation; do not rely on hue alone |
Mistake 10 is the highest-leverage fix in the table. Title the chart with the claim it makes, not with the variables it plots. "Accuracy by category" is a label; "Refunds accuracy is 42%, less than half of every other category" is a finding. If you cannot write the second kind of title, the chart has not found anything yet.
Which chart should I use to show a distribution?
A histogram, and it is the answer the exam wants. It bins a continuous variable and shows the count in each bin, so shape, centre, spread, skew, and — critically — modality are all visible. A box plot is often offered as the alternative and is a different tool: it summarises the distribution into five numbers plus outliers, which makes it excellent for comparing many groups at once and completely blind to whether a distribution has one peak or two. So: histogram to understand one distribution, box plots side by side to compare several, and both when you can afford the space. The one refinement to remember for LLM work is the axis — token lengths, latencies, and costs are heavy-tailed, and a linear-axis histogram of heavy-tailed data collapses the informative part into the leftmost bin. Log the axis and label it.
What is the difference between a histogram and a bar chart?
The x-axis. A histogram's x-axis is a continuous number line divided into bins, so the bars touch — the space between them would falsely imply values that cannot occur. A bar chart's x-axis is a set of discrete categories with no ordering or spacing relationship, so the bars are separated, and the categories can be reordered (usually sorted by value) without changing what the chart means. Reordering a histogram's bins would be meaningless. A quick test: if you can sort the bars by height and the chart still makes sense, it is a bar chart. This pair is the most frequently confused item in the six-way mapping, which is exactly why it gets asked.
Does a correlation on a scatter plot prove causation?
No, and this is one of the reliably-tested points in the Data Analysis domain. A visible association between two variables is equally consistent with A causing B, B causing A, some third variable C causing both (a confounder), a selection effect in how the data was collected, and pure coincidence — the last of which becomes common the moment you test many variable pairs, since with enough pairs some will correlate strongly by chance. That is a spurious correlation. The only thing that upgrades an association to a causal claim is an intervention where you manipulate the suspected cause and hold the rest constant: a randomised experiment, which for a software system means an A/B test (10-03). Practical discipline: state associations as associations, name the confounder you are worried about, and when you cannot run an experiment, say so in the same sentence as the finding.
When should I use Spearman instead of Pearson correlation?
Use Spearman when your data is ordinal, when it is skewed or contains outliers, or when you expect the relationship to be monotonic but not linear — Spearman operates on ranks, so it measures whether higher goes with higher regardless of the shape of the curve, and an extreme value is merely the highest rank rather than a lever on the result. Use Pearson when you specifically care about linear association on the raw values and outliers are controlled. For most LLM-adjacent quantities — token counts, latencies, costs, per-item scores — the distributions are heavy-tailed enough that Spearman is the safer default. And report both when they diverge: a large Pearson–Spearman gap, like the 0.31 versus 0.68 in the worked example, tells you outliers or nonlinearity are driving the number, which is a finding in itself. Either way, plot the scatter; a coefficient without a scatter behind it is a number nobody has checked.
Why can an aggregated chart not show group-level harm?
Because aggregation removes the dimension along which the harm exists, and no property of the resulting chart can restore it. When you compute one accuracy figure across all users, the group identity of each observation is discarded during the computation, before any drawing happens — so the chart is not hiding the subgroup gap, it has no representation for it. This is a structural fact rather than a shortcoming of the chart type, which is why "make a better aggregate chart" is not a remedy and only disaggregation is. The operational consequence is a review rule: an aggregate metric should never be reported without its per-group breakdown, on shared axes, with sample sizes shown. That rule is what turns visualization from a communication skill into a fairness instrument, and it connects directly to the nondiscrimination pillar in NVIDIA's trustworthy-AI framing [NVIDIA-DOC] and to the bias-measurement practice in 13-04.
What is Simpson's paradox and how do I avoid being fooled by it?
Simpson's paradox is when a relationship that holds in every subgroup reverses direction once the subgroups are pooled, because the subgroups differ both in their outcome rates and in their share of the total. The illustrative table in section 2 shows it: Model A beats Model B on long queries and on the same logic within short queries would need checking, yet B wins the pooled comparison by 24 points purely because B was evaluated mostly on the easy subgroup. Avoiding it is a habit rather than a test: before pooling, ask what varies between the groups you are pooling, and whether the group mix differs between the things you are comparing. If the mix differs, the pooled number is partly a statement about the mix. Then plot it disaggregated — grouped bars or small multiples on shared axes — and if the disaggregated and pooled views disagree, trust the disaggregated one and report the mix explicitly. The related discipline in evaluation is to compare models on identical, frozen item sets, which is why dataset versioning in 08-01 and eval-set discipline in 09-01 are load-bearing here.
Glossary recap: the terms this lesson introduced
| Term | Definition |
|---|---|
| Histogram | Chart binning one continuous variable to show its distribution: shape, centre, spread, skew, modality. Bars touch. |
| Box plot | Five-number summary (median, quartiles, whiskers) plus marked outliers; ideal for comparing many groups, blind to modality. |
| Interquartile range (IQR) | The box's extent, Q3 − Q1; whiskers conventionally extend 1.5 × IQR. |
| Scatter plot | Two continuous variables as position; the only common chart showing nonlinearity, clusters, and bivariate outliers. |
| Overplotting | Saturation of a scatter when too many points overlap, hiding density; fixed by transparency, hexbin, or density plots. |
| Bar chart | Magnitude comparison across discrete categories via length; requires a zero baseline. |
| Heatmap | A matrix encoded as colour intensity; correlation matrices need a diverging palette, counts need a sequential one. |
| Confusion matrix | A heatmap of predicted versus actual classes, revealing which classes are mistaken for which. |
| Line chart | An ordered sequence, asserting continuity between consecutive points; the chart for trends and learning curves. |
| Learning curve | Loss or metric plotted against epoch for training and validation together; the divergence diagnoses overfitting. |
| Axis truncation | Starting a length-encoded axis above zero, arbitrarily magnifying apparent differences. The canonical dishonest chart. |
| Log-scaled axis | An axis on a logarithmic scale, required to read heavy-tailed distributions; must be labelled. |
| Small multiples | The same chart repeated once per group on shared axes; the general antidote to aggregation. |
| Disaggregated visualization | Computing and plotting a metric per group, which is the only way group-level harm becomes visible. |
| Simpson's paradox | A subgroup trend that reverses when subgroups are pooled, driven by differing group mixes. |
| Spurious correlation | A statistical association with no causal link; increasingly likely as the number of tested pairs grows. |
| Confounder | A third variable causing both of two associated variables, producing correlation without direct causation. |
| Pearson correlation (r) | Strength of the linear relationship on raw values; outlier-sensitive. |
| Spearman correlation (ρ) | Strength of the monotonic relationship on ranks; robust to outliers and to nonlinearity. |
| Diverging vs sequential palette | Diverging for signed data with a meaningful midpoint (correlations); sequential for magnitudes (counts). |
Key takeaways on choosing the right chart
- Memorise the six-way mapping verbatim: histogram = distribution · box plot = spread and outliers · scatter = relationship · bar = comparison · heatmap = matrix/correlation · line = trend. It is a fast recognition item and directly reported exam content.
- Histogram vs bar chart is the axis. Continuous binned axis, bars touching, versus discrete categories, bars separated and sortable.
- Box plots cannot show modality. Use a histogram when shape matters, box plots when comparing many groups — and annotate n on every box.
- Always plot the scatter before trusting a correlation coefficient, and log heavy-tailed axes before reading a histogram.
- Zero-baseline every bar chart. Axis truncation on a length encoding is the canonical dishonest chart.
- Correlation is not causation; only an intervention establishes causation, and spurious correlations multiply with the number of pairs you test.
- Pearson is values and linearity; Spearman is ranks and monotonicity. A large gap between them is itself a finding.
- Simpson's paradox reverses pooled conclusions when group mixes differ. Check the mix before pooling.
- An aggregated chart is structurally incapable of showing group-level harm — the dimension was removed before the chart existed. Only disaggregation can reveal it.
- Therefore disaggregated visualization is a fairness instrument. Require per-group views with shared axes and sample sizes as a review artefact, connecting to the nondiscrimination pillar
[NVIDIA-DOC]. - Title the chart with its claim, not its variables. If you cannot write the claim, the chart has not found anything.
- Sometimes the right output is not a chart — a sentence for one number, a table when exact values must be compared.
Next: GPU-accelerated data science with RAPIDS
Every measurement and chart in this module has assumed the data fits comfortably on one machine's CPU. At corpus scale it does not, and the deduplication, aggregation, and clustering steps that this module treats as one-liners become the slow parts of the working day.
Next: 08-05 covers NVIDIA RAPIDS at exactly the depth the exam wants — recognition. cuDF is GPU pandas, cuML is GPU scikit-learn, cuGraph is GPU NetworkX: three components, three CPU libraries they replace, one memorised mapping, plus the honest account of when GPU acceleration actually pays for itself and when it is overhead you paid for nothing. It closes this module and hands you to 09-01, where the evaluation set you built by hand grows to a hundred items.