Worked graphing example

Four bars. Twelve measurements. One decision you have to make.

A grouped bar graph is the default figure for a two-factor experiment. The bar heights are rarely the problem — the error bars are, because three different bars are all defensible and they claim three different things.

2 × 2 design3 replicates per cellAll 12 values visible7-minute read

The problem

The bar hides the data that produced it.

A bar reports one number: usually the group mean. Everything else about the group — how many observations there were, how far apart they were, whether one value drove the result — is carried entirely by the error bar, or lost. Choosing that error bar is a scientific decision, not a formatting one.

The experiment

Two genotypes (wild-type, mutant) crossed with two treatments (control, drug), three independent replicates per cell. Every measured value is shown, because a figure that summarises twelve numbers should not be harder to audit than the twelve numbers.

Genotype Treatment Replicate values Mean
Wild-type Control 42, 39, 45 42.00
Mutant Control 40, 44, 41 41.67
Wild-type Drug 55, 58, 52 55.00
Mutant Drug 78, 82, 75 78.33

The same four bars, three error bars

Each column below is drawn from the identical twelve values. Nothing about the experiment changed; only the claim the figure makes did.

Group SD SEM 95% CI half-width
Wild-type · Control 3.000 1.732 ±7.452
Mutant · Control 2.082 1.202 ±5.171
Wild-type · Drug 3.000 1.732 ±7.452
Mutant · Drug 3.512 2.028 ±8.724

The 95% intervals use the t distribution with n − 1 = 2 degrees of freedom, where the two-sided 97.5% quantile is 4.3027. That multiplier is why the honest interval is more than four times the SEM bar at n = 3.

What each bar claims. SD describes how much the observations vary — it does not shrink as you collect more data, and it is the right bar when the reader needs to know the spread of the biology. SEM describes how precisely you estimated the mean; it shrinks with √n, so it is the smallest bar and the easiest to misread as a strong result. 95% CI describes a range of means compatible with the data at the stated confidence level, and is the bar that most directly supports a comparison.

At n = 3, the smallest bar is the least honest

Wild-type control has SD 3.000 and SEM 1.732 — but its 95% interval spans ±7.452. A reader who sees the SEM bars sees a tidy figure with barely overlapping whiskers; a reader who sees the confidence intervals sees how little three replicates actually pin down. Both figures are drawn from the same experiment.

Do not read significance off overlapping or non-overlapping error bars. Overlap of 95% intervals does not imply P > 0.05, and non-overlapping SEM bars do not imply P < 0.05. The comparison you care about here — whether the drug does more in the mutant than in the wild-type — is an interaction, and it is tested by the model, not by the picture. See the two-way ANOVA interaction guide for that analysis on this same table.

With three replicates, plot the points

A bar plus an error bar spends most of its ink on a rectangle that carries a single number. At small n, showing every observation costs nothing and answers questions the summary cannot: is the spread symmetric, is one replicate an outlier, did the groups have the same n at all? Reserve bars for counts and proportions, where the bar length is itself the quantity, and prefer a scatter or dot plot with a mean line when n is small enough to draw.

Limit: nothing on this page validates the design. Three replicates per cell is a small experiment; if the three values are repeated reads of one biological sample rather than three independent samples, every interval above is too narrow and the analysis is answering the wrong question. See technical vs biological replicates.

Building the figure

  1. Enter the design as a Grouped table — one factor across columns, the other down row groups — so the graph and the analysis read the same structure.
  2. Keep replicates as side-by-side subcolumns rather than pre-averaging them; a table of means cannot produce an error bar or an interaction test.
  3. Choose the error bar deliberately and name it in the caption. An unlabelled error bar is unreadable.
  4. Overlay the individual replicates on the bars, or switch to a points-with-mean plot at small n.
  5. Run the two-factor analysis on the same table, and report the interaction before either main effect.

What Plotwright checks

The descriptive route that produces these means, SDs, SEMs and t-based intervals runs through the same numerical engine as the published-example suite, and the engine's descriptive and two-factor routes carry reference checks on the validation page. The values in the tables above were computed from the twelve visible observations; they are reproducible from the linked editable project.

Limit: a reproducible error bar is not a correct error bar. The engine will draw whichever one you ask for. Deciding which claim your figure should make remains the researcher's responsibility.

Sources and reproducibility

  1. Cumming, G., Fidler, F. & Vaux, D. L. (2007), “Error bars in experimental biology”—what SD, SEM and confidence-interval bars each mean, and why overlap rules mislead.
  2. SD vs SEM error bars—the same distinction worked through 25 visible values.
  3. Two-way ANOVA and the interaction—the analysis for this exact table.
  4. Plotwright statistical validation—published expected values, numerical tolerances and evidence limits.

Let the figure and the test read the same table.

Plotwright keeps the raw replicates, the descriptive summary, the two-factor analysis and the editable graph together in one inspectable project.