Data Visualization for Neuroscience

Before we say a word about theory: scroll slowly through the gallery below. For each figure, ask yourself — do I like it or not, and why?


Now Let’s Take Them Apart

1. First principles: make the ink carry data

Gallery figure 10

This figure contains exactly three numbers. Count how many visual devices are competing to tell you them — and ask which of those devices encodes any data at all.

Removed: the tinted background, the white gridlines, the hatching, the heavy borders, the saturated primaries, the bold shouting label. Not one of them encoded data. What remains is three bars, three error bars, and a readable axis — the same information, now arriving in one glance instead of five.

Tufte’s term for the removed material is chartjunk, and his test is the data-ink ratio: of all the ink on the page, what fraction varies with the data? Decoration does not just waste space, it actively competes with the signal for the reader’s attention. When in doubt, delete something and see whether the figure got worse.

2. Show the data, not just a summary of it

In a survey of top physiology journals, 47.7% of papers used bar graphs to present continuous data, often for samples as small as n = 3–5 (Weissgerber et al. 2015). That is precisely where bars mislead most.

Gallery figure 1

A drug raises firing rate by 28%, with a star to prove it. What does this figure let you check — and what is it preventing you from seeing?

These are the same ten neurons. On the left, a clean 28% increase, error bars that barely overlap, p = 0.035. On the right, the drug group splits into two populations: five cells responded strongly and five did not respond at all. The mean sits in the empty gap between them, describing no cell in the experiment.

The statistics are not wrong — the test is significant. But “the drug raises firing rate by 28%” and “the drug strongly affects half of these cells and leaves the rest untouched” are completely different biological claims, and only one of them is true. The bar could not tell you which. Gallery figure 13, which you saw and probably liked, was the answer all along.

This is why bars are dangerous for continuous data at small n: a bar plus an error bar is a lossy compression with only two numbers surviving, and many very different datasets compress to the identical picture:

Same means, same SEMs, interchangeable bars — but A is normal, B is bimodal (its mean describes no real cell), C is driven by two outliers, and D is skewed. Show the points whenever n allows it: strip, box, violin, or raincloud (Weissgerber et al. 2015; Wilke 2019, ch. 9).

Gallery figure 14 makes the related point for paired designs. Each line is one subject measured twice. Plotted as two separate clouds these groups would overlap heavily and look unconvincing; drawn as pairs, every single subject increases. The pairing is the experiment, so the figure has to show it — and the matching paired test is far more powerful than the unpaired one.

3. Match the plot to the question

Gallery figure 8

There is clearly a relationship here. But what exactly is being claimed — how strong is it, in what units, and could this cloud have arisen by chance?

Same points both sides. The right panel adds a fitted line, a confidence band, and the two numbers a reader needs — that was gallery figure 11. A scatter alone asks your reader to eyeball a trend; adding the fit states the claim in units (“each 1% of contrast adds ~0.9 Hz”) and quantifies the uncertainty around it.

A caution in the other direction: never let the line replace the points. The line without the scatter hides how much variance is left over, which is exactly what the confidence band and \(r\) are there to admit.

Quick — from the pie, is there more SST or VIP? Is “Other” bigger than “NDNF”? Human eyes compare lengths along a common baseline well and angles and areas badly, so nine slices is close to unreadable. Sorting the same proportions into a bar makes every comparison instant. Reserve pies for two or three categories, if at all.

The two lines on the left appear to track each other — but that apparent relationship was manufactured entirely by the choice of axis ranges. Slide either axis and it vanishes. Dual y-axes let you imply a correlation you have not measured. Give each measure its own panel with a shared x-axis (right), and if you genuinely want to claim a relationship, plot one variable against the other and report a statistic (Midway 2020).

4. When you have too much data

Gallery figure 4

Twenty-eight single trials, all overlaid. What can you actually determine about any individual trial? What about the population?

The same traces. On the left they form an opaque mat — no trial is followable and the density is unreadable because lines drawn later simply cover lines drawn earlier. On the right, small multiples: one trial per panel, shared axes, so both the shared structure and the trial-to-trial variability are visible. That was gallery figure 12. All nine panels share one scale, marked once by the scale bar in the top-left panel, rather than repeating the same tick labels nine times — stripped axes are fine when the reader can recover them from a single shared key.*

When overlaying is genuinely necessary, plot the mean with a shaded variability band on top of faint individual traces, so the summary and the spread coexist without either being hidden.

Four thousand points at full opacity produce a silhouette, not a distribution — the middle could hold half the data or nine-tenths of it and the figure would look the same. Shrinking the markers and dropping opacity to ~0.1 recovers the density for free. At larger scales still, switch encoding entirely: 2D histogram, hexbin, or contours.

5. Color

For heatmaps and other magnitude-encoding color scales, the defaults are: viridis / magma, cividis when a figure may be printed in black and white, and a diverging map (coolwarm) only when there is a meaningful midpoint such as zero. Avoid jet and other rainbow maps — they are not perceptually uniform, so equal steps in the data produce unequal steps in apparent brightness, inventing bands and edges that are not in the data. Always label the color scale; an unlabelled one is unreadable (Wilke 2019, ch. 19).

Gallery figure 5

Two groups, red and green, cleanly separated. Roughly 8% of men of northern-European ancestry cannot read this figure. Can you predict what they see?

On the left, the same figure simulated for the commonest form of red-green colorblindness: the two groups become nearly the same muddy color and the result is gone. On the right, Wong’s (2011) blue/orange — distinguishable to essentially every reader — plus a different marker shape for each group.

The shape is the real lesson. Make color redundant: encode group membership with position, shape, or line style as well, so the figure survives colorblindness, grayscale printing, a bad projector, and a photocopy. If your figure collapses when converted to grayscale, color was doing structural work it should not have been doing alone.

6. Axes and honesty

Gallery figure 3

KO looks dramatically higher than WT. Read the y-axis carefully, then say how large the difference actually is.

100 versus 102 — a 2% difference, presented on the left as though it were enormous, purely by starting the axis at 98. A bar encodes its value by length, so truncating the axis breaks the encoding: the KO bar is drawn four times the height of the WT bar to represent 1.02 times the value.

For bar charts the baseline must be zero. For line plots and scatters, zero is optional and context sets it — but the moment you truncate, say so clearly. Related axis manipulations to watch: stretching the aspect ratio to flatten or steepen a trend, and unlabelled log scales, which are often necessary but make order-of-magnitude differences look modest (Rougier et al. 2014, rule 6). And always state in the caption whether error bars are SD, SEM, or CI — they differ by a factor of √n and the reader cannot tell them apart.

7. Make it legible at final size

Both panels are the same data at the same physical size. The left is what happens when a figure is designed at full screen width and then dropped into a one-column layout or projected to the back of a lecture hall: axis labels become unreadable, and 3-point markers disappear.

Figures shrink; they never grow. Design at the size it will be read, not the size of your monitor, then check it by printing it or standing back from the screen. Practical floors: 7–8 pt minimum text in a print figure, marker sizes that stay visible at final scale, and line weights heavy enough to survive. Keep font sizes consistent across every panel of a paper — a figure whose text is smaller than its neighbours’ looks like an afterthought.

8. Figures specific to neuroscience

Gallery figure 15 does the standard thing well: a raster over a PSTH, sharing one time axis, with the stimulus marked in both. The raster preserves single-trial structure; the histogram below gives the trial-averaged rate. Neither alone would do — the raster hides the average, the PSTH hides the trial-to-trial reliability. Keep the tick marks thin so dense trials do not smear into a solid block.

Two further habits matter more in neuroscience than almost anywhere else.

Pair every example with its population. A single beautiful trace (left) proves nothing on its own — it could be the best cell of two hundred. Showing the example beside the distribution it came from (middle) lets the reader judge whether it was typical.

Sorting a heatmap is an analysis choice, not a cosmetic one. The right panel looks like a clean sequence of activity because the cells were sorted by peak time — and sorting pure noise the same way produces an equally clean-looking sequence. Sort by an independent criterion (peak time from held-out trials, or an anatomical variable), never by the very effect you are displaying. The same double-dipping problem applies to selecting cells by a response and then reporting that response.

Finally, recall the pseudoreplication point from the statistics page: when cells are nested within animals, plot both — faint points for cells, bold points for per-animal means — so the reader can see how much of the effect rests on how few animals.

9. Less is more

Section 1 was about ink that never carried data — chartjunk, easy to condemn once you see it. This is the harder version: cutting ink that does carry real, hard-won data, because it does not serve the claim this particular figure is making. “But it’s real data” is not an argument for keeping it in — it is an argument for a different figure, or the supplement.

The discipline is one figure, one claim. Before drawing anything, write the one sentence the figure needs to support. Everything that answers a different question does not belong here.

Every condition is here: six doses, three timepoints, both groups, an unrelated covariate on a second axis, an inset of raw differences, a legend with nine entries, and a text box of statistics. Every element is real data. The claim — that the drug shifts the dose-response curve rightward — is nowhere to be found in this much material.

Drop the two timepoints not being compared and the covariate: neither bears on the claim about EC50. Keep six doses and both groups. The rightward shift is now visible, though the reader still has to look up two legend entries to know which curve is which.

Direct labels replace the legend, and the shift itself is drawn and quantified once. The claim reads in about a second. Something real was lost at each step — the raw traces, the covariate, two of three timepoints — and the position here is that it was worth losing, not that it was free.

Which version made the claim fastest? What did you lose to get there?

This sits in tension with Section 2, which argues for showing more — every point, not just the mean. Both are answering the same question: what does the reader need to evaluate this specific claim? Section 2 says summary statistics alone are not enough evidence for the claim; this section says data that is not evidence for the claim does not belong in the figure. They are the same principle applied in opposite directions.

A few practical tests:

  • Write the claim first. If you cannot state it in one sentence, the figure is not ready to be drawn.
  • Direct labels beat legends. A legend forces a lookup on every glance; a label at the end of a line costs nothing.
  • A second question is a second figure. Data that answers something else is not free context — it competes for attention with the thing you actually want the reader to see.
  • Panels are not free. Every additional panel divides attention that the main result needs.
  • Cover-and-check. Cover any single element of the figure. If the claim still holds up without it, that element was not carrying the claim.

Resources

The principles here are drawn from a small, excellent literature worth assigning:

  • Weissgerber, Milic, Winham & Garovic (2015). Beyond Bar and Line Graphs: Time for a New Data Presentation Paradigm. PLOS Biology. — Why bar charts hide your data. link
  • Rougier, Droettboom & Bourne (2014). Ten Simple Rules for Better Figures. PLOS Computational Biology. — A short, citable do/don’t checklist. link
  • Wong (2011). Points of View: Color Blindness. Nature Methods. — Origin of the colorblind-safe palette used here; the whole Points of View series is excellent. link
  • Midway (2020). Principles of Effective Data Visualization. Patterns (Cell Press). — Ten modern principles. link
  • Wilke (2019). Fundamentals of Data Visualization. O’Reilly — free online. — The reference textbook. link

Instructor cheat sheet

The bad figures

# What it is Usually spotted right away Push them toward Becomes
1 Bar + SEM, drug vs. control, star “Where are the data points?” The drug group is two subpopulations — 5 responders (~56–67 Hz), 5 non-responders (~31–40 Hz). Mean 50.3 falls in an empty gap. The test is genuinely significant; the biological claim is wrong. Also: SEM chosen over SD because the bars look tighter. fig 13
2 Pie, 9 cell-type slices “Too many slices” Eyes compare length on a common baseline well, angle and area badly. Ask them to rank SST vs. VIP, or “Other” vs. NDNF — they can’t without reading the numbers, which means the graphic is doing no work. sorted bar
3 WT vs. KO bars, y-axis 98–103.5 “The axis doesn’t start at zero” It’s a 2% difference drawn as a 4× height ratio. Bars encode by length, so truncation breaks the encoding — this is the one case where zero is non-negotiable. Note the red adds unearned alarm. zero baseline
4 28 overlaid single trials “Too busy / spaghetti” Overdraw: lines drawn later hide lines drawn earlier, so the apparent density is an artifact of plot order. No single trial is followable and no summary is available — it fails at both jobs. fig 12
5 Red vs. green scatter Often nothing — it looks fine ~8% of men with northern-European ancestry can’t separate these. Show the deuteranope simulation. Deeper point: color is the only cue — no shape, no position. Ask what happens in grayscale. blue/orange + shape
6 Scatter, 5 pt labels, 3 pt markers “I can’t read it” Figures shrink, never grow. Designed at monitor width, then dropped into a one-column layout or projected to the back of a hall. Floors: ~7–8 pt text, markers visible at final scale. Ask what size they design at. legible sizing
7 Firing rate + body weight, dual y “Two axes is confusing” The apparent tracking is manufactured by the axis ranges — slide either and it vanishes. It implies a correlation that was never computed. If you want the claim, plot one against the other and report a statistic. two panels
8 Clean scatter, no fit Often “looks good!” Nothing is quantified — no slope (with units), no r, no p, no uncertainty. The reader is asked to eyeball a trend. Useful counter-question: “how strong is it?” — nobody can answer. fig 11
9 4000 opaque points, s=80 “Too dense / blobby” It’s a silhouette, not a distribution — the center could hold half the data or 90% and it would look identical. Fix is nearly free: shrink markers, alpha ≈ 0.1. At larger n, change encoding (hexbin, 2D histogram). alpha + density
10 Chartjunk bars “Ugly,” “too much” Make them count the devices: tinted background, gridlines, hatching, heavy borders, saturated primaries, bold caps label — six devices for three numbers, and not one encodes data. This is the data-ink ratio in one picture. clean bars

The good figures (and what each is there to prove)

# What it is The point it makes
11 Scatter + fit + CI band + r, p Quantifies the claim in units and shows the uncertainty around it. The reveal for fig 8 — same data.
12 3×3 small multiples + scale bar Shared axes let you read both common structure and trial-to-trial variability. One labelled scale bar stands in for nine repeated axes. The reveal for fig 4 — same traces.
13 Bar with every point overlaid Exposes the two subpopulations fig 1 concealed. The reveal for fig 1 — same ten neurons.
14 Paired pre/post with connecting lines The pairing is the experiment. As two clouds these overlap and look unconvincing; as pairs, every subject rises.
15 Raster over PSTH, shared time axis Single-trial structure and trial-averaged rate. Neither panel alone is sufficient.