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.

01

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:

ChartAnswers the questionShowsData it needs
Histogram"What does the distribution of this variable look like?"shape, centre, spread, skew, modalityone continuous variable
Box plot"How spread out is it, and where are the outliers?"median, quartiles, IQR, outliers — and comparison across groupsone continuous variable, optionally split by a category
Scatter plot"Are these two variables related?"correlation, clusters, nonlinearity, bivariate outlierstwo continuous variables
Bar chart"How do categories compare on this value?"magnitude comparison across discrete groupsone categorical + one numeric
Heatmap"What is the structure of this matrix?"correlation matrices, confusion matrices, two-way patternsa 2-D grid of values
Line chart"How is this changing over time?"trend, seasonality, change pointsan 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.
02

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:

  1. How many variables am I showing? One, two, or many.
  2. What are their types? Continuous, categorical, or ordered/temporal.

That produces a lookup:

VariablesTypesChart
1continuoushistogram (shape) or box plot (summary + outliers)
1categoricalbar chart of counts
2continuous + continuousscatter plot
2categorical + continuousbar chart, or box plot per group if you want the distribution not just the mean
2time + continuousline chart
2categorical + categoricalheatmap of counts, or grouped bars
manycontinuouscorrelation heatmap, or a scatter matrix
2categorical + continuous, and you care about subgroupsbox 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:

GroupModel AModel B
Short queries90/100 = 90%190/200 = 95%
Long queries40/200 = 20%12/100 = 12%
Combined130/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 (ρ)
Measuresstrength of the linear relationshipstrength of the monotonic relationship
Computed onthe raw valuesthe ranks of the values
Assumesroughly linear relationship, continuous dataonly that the variables are ordinal or better
Sensitive to outliersyes, stronglymuch less so — an extreme value is just the top rank
Detects a curved but always-increasing relationshippoorly (r can be well below 1)well (ρ can be 1.0)
Use whenyou believe the relationship is linear and outliers are controlleddata 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.

03

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…UseNotBecause
What is the distribution / shape of this variable?histogrambar chartbars must touch on a continuous axis; a bar chart implies discrete categories
Is this variable skewed or bimodal?histogrambox plota box plot cannot show modality at all
Where are the outliers, and how spread out is it?box plothistogramoutliers are individually marked and quartiles are explicit
How do these 12 groups' distributions compare?box plots side by side (or violins)12 histogramsside-by-side boxes are comparable at a glance on shared axes
Are these two continuous variables related?scatter plotline charta line asserts sequential continuity that a relationship does not have
Is there a nonlinearity or a cluster in this relationship?scatter plotcorrelation coefficient alonethe coefficient collapses shape into one number
Which category has the highest value?bar chart, sorted, zero-baselinedpie chartlength comparison beats angle comparison; pies fail past ~4 slices
How did this metric change over the last 90 days?line chartbar charttrend and change points are the point; bars fragment the sequence
Which features are correlated with which?correlation heatmap, diverging palettemany scatter plotsone glance across all pairs; use scatters to follow up on what it flags
Which classes does the model confuse?confusion-matrix heatmapaccuracy numberthe structure of the errors is the finding
Is the model overfitting?line chart of train and validation loss vs epochfinal metricthe 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 groupany aggregate chartthe aggregate is structurally incapable of showing it
What share of the whole is each part?stacked bar or sorted barpie chartacceptable for a small number of parts; a sorted bar is usually still clearer
How are two categorical variables jointly distributed?heatmap of countstwo separate bar chartsthe 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

04

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.

CategorynMedian latency (ms)IQROutliers above whisker
Billing324780610–1,0104
Technical6121,240890–2,10031
Account180810640–1,0602
Refunds241,9101,320–3,4005
Other60900700–1,1803

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.

05

When to reach for each chart, and when a chart is the wrong output

SituationReach forAvoidNote
Profiling a new corpus's length distributionhistogram, log x-axislinear-axis histogramheavy tails make linear axes unreadable
Comparing latency across many servicesbox plots, n annotatedbar chart of meansmeans hide the tail that users experience
Reporting p95 latency to stakeholdersa labelled number plus a box plota meanpercentiles are the operative statistic (12-10)
Screening 40 features for relationshipscorrelation heatmap, diverging palette780 scatter plotsheatmap to triage, scatter to confirm
Confirming a relationship flagged by the heatmapscatter plottrusting the coefficientshape and outliers only appear in the scatter
Showing improvement across model versionsgrouped or sorted bar, zero baselinetruncated-axis bartruncation is the canonical dishonest chart
Diagnosing a training runline chart, train and validation togetherfinal-metric tablethe divergence is the diagnosis
Reporting fairness or subgroup performancedisaggregated bars / small multiples, shared axes, n shownany aggregateaggregates cannot represent subgroup gaps
Showing composition of 3 partssorted bar or stacked barpie chartlength beats angle; pies fail past ~4 slices
Two variables, 500,000 pointshexbin or 2-D densityraw scatteroverplotting saturates and hides density
A single number is the whole findingno chart — write the number in a sentencea chart with one bara one-bar chart is decoration and dilutes the report
Precise values must be looked up and compareda tableany charttables win when reading exact values is the task
The audience is non-technical and the claim is causala chart plus an explicit statement of what the data cannot establisha chart implying causationsee 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.

06

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 familyLooks likeWhy 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 coefficientoffered for skewed or ordinal dataPearson 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 rigoura dashboard of 20 charts as the deliverablea chart earns its place by making one comparison faster; the rest dilute
07

Common mistakes with charts and visualization

#SymptomCauseFix
1A distribution looks unimodal and smooth; the data is notbin width too wide, or a box plot used instead of a histogramtry several bin widths; use a histogram when shape matters
2The whole distribution crushes into the first binlinear axis on heavy-tailed datalog-scale the axis and label it as logged
3A small difference looks dramaticy-axis truncated on a bar chartzero-baseline every length encoding; label any non-zero baseline on a line chart
4A scatter is a solid black bloboverplottingtransparency, hexbin, or 2-D density; subsample as a last resort
5Two groups look equally reliable but one has 12 pointssample size not encodedannotate n on every group; consider marker size or confidence intervals
6A correlation heatmap makes −0.9 and +0.9 look similarsequential palette on signed datadiverging palette centred at zero; annotate cells when the grid is small
7A model chosen on aggregate scores loses in productionSimpson's paradox — the evaluation mix differed from the traffic mixdisaggregate by the mix variable; compare like subgroups
8A fairness review passes and users report a group-level failureonly aggregate charts were reviewedrequire disaggregated views as a review artefact, not an option
9Small multiples appear to show no difference between groupsper-panel autoscaled axesshared axes across every panel, always
10A chart is beautiful and nobody can say what it showsno question was stated before chartingwrite the question in the title; if the title is not a claim, the chart has no job
11Colour-coded categories are unreadable for some readerscolour used as the only channeladd 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

TermDefinition
HistogramChart binning one continuous variable to show its distribution: shape, centre, spread, skew, modality. Bars touch.
Box plotFive-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 plotTwo continuous variables as position; the only common chart showing nonlinearity, clusters, and bivariate outliers.
OverplottingSaturation of a scatter when too many points overlap, hiding density; fixed by transparency, hexbin, or density plots.
Bar chartMagnitude comparison across discrete categories via length; requires a zero baseline.
HeatmapA matrix encoded as colour intensity; correlation matrices need a diverging palette, counts need a sequential one.
Confusion matrixA heatmap of predicted versus actual classes, revealing which classes are mistaken for which.
Line chartAn ordered sequence, asserting continuity between consecutive points; the chart for trends and learning curves.
Learning curveLoss or metric plotted against epoch for training and validation together; the divergence diagnoses overfitting.
Axis truncationStarting a length-encoded axis above zero, arbitrarily magnifying apparent differences. The canonical dishonest chart.
Log-scaled axisAn axis on a logarithmic scale, required to read heavy-tailed distributions; must be labelled.
Small multiplesThe same chart repeated once per group on shared axes; the general antidote to aggregation.
Disaggregated visualizationComputing and plotting a metric per group, which is the only way group-level harm becomes visible.
Simpson's paradoxA subgroup trend that reverses when subgroups are pooled, driven by differing group mixes.
Spurious correlationA statistical association with no causal link; increasingly likely as the number of tested pairs grows.
ConfounderA 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 paletteDiverging for signed data with a meaningful midpoint (correlations); sequential for magnitudes (counts).

Key takeaways on choosing the right chart

  1. 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.
  2. Histogram vs bar chart is the axis. Continuous binned axis, bars touching, versus discrete categories, bars separated and sortable.
  3. Box plots cannot show modality. Use a histogram when shape matters, box plots when comparing many groups — and annotate n on every box.
  4. Always plot the scatter before trusting a correlation coefficient, and log heavy-tailed axes before reading a histogram.
  5. Zero-baseline every bar chart. Axis truncation on a length encoding is the canonical dishonest chart.
  6. Correlation is not causation; only an intervention establishes causation, and spurious correlations multiply with the number of pairs you test.
  7. Pearson is values and linearity; Spearman is ranks and monotonicity. A large gap between them is itself a finding.
  8. Simpson's paradox reverses pooled conclusions when group mixes differ. Check the mix before pooling.
  9. An aggregated chart is structurally incapable of showing group-level harm — the dimension was removed before the chart existed. Only disaggregation can reveal it.
  10. 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].
  11. Title the chart with its claim, not its variables. If you cannot write the claim, the chart has not found anything.
  12. 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.