SOFTWARE

Error Bars and Bar Charts in Materials Papers: SD, SEM or 95% CI, and What n Really Means

What reviewers expect from error bars: when to use standard deviation, standard error or confidence intervals, how to count n for specimens and measurements, why to show individual data points, and how to write it in captions, with a free plotting tool.

By Jerry Hu 8 min read 閱讀中文版
Error Bars and Bar Charts in Materials Papers: SD, SEM or 95% CI, and What n Really Means

Quick answer: Choose the error bar by the question it answers:

  • SD shows how much individual specimens vary.
  • 95% confidence interval shows how precisely you know the mean.
  • SEM is mostly an intermediate quantity. On its own it makes data look tighter than it is.

Count n as independent specimens or batches, not repeated measurements on one specimen. With n below about 10, show every data point next to the mean, not just a bar. Always say in the caption what the bars are and what n is. The free dotplot_ci.py draws this and prints the numbers.

Why reviewers care

Error bars are one of the most misread elements in scientific figures, and not only by students:

  • In their Nature Methods column “Error bars”, Krzywinski and Altman report a study in which researchers were asked how far apart two means with error bars must be to differ at P = 0.05. Only 22% answered within a factor of two [2].
  • In the same column they counted error bars in Nature Methods itself in 2012. About two-thirds of eligible panels had them, split almost evenly between SD and SEM, and only one figure used 95% confidence intervals [2].
  • Cumming, Fidler and Vaux, writing in the Journal of Cell Biology, stress that different error bars convey quite different information, so the figure legend must say which one is shown, and they give eight practical rules [1].
  • Weissgerber and co-authors reviewed 703 papers in top physiology journals in PLoS Biology and found that continuous data were mostly shown as bar and line graphs, which hide the data distribution. Many different datasets produce the same bar [3].

Materials papers have the same problems, often in mechanical properties (strength, hardness, toughness), electrical properties and “optimised” conditions shown as bar charts.

The same bar can hide very different data

Two bar charts with identical mean and SD (20.0 ± 1.6 MPa). The data on the left are five evenly spread values; on the right, three low values and two high values, i.e. two populations.

Both bars show 20.0 ± 1.6 MPa (mean ± SD, n = 5). On the right, the data split into two groups, which might be two powder batches, two furnace runs or a contamination problem. The bar alone hides this completely.

This is Weissgerber’s central point [3], and it is why many journals now encourage or require individual data points for small samples.

SD, SEM and 95% CI: what each one answers

BarFormulaAnswersShrinks with more samples?Use it when
SD (standard deviation)spread of the n values”How different are individual specimens?”NoShowing scatter or reproducibility, e.g. strength variation of a process
SEM (standard error of the mean)SD / √n”How precisely is the mean estimated?” (not directly interpretable)YesRarely on its own. It is the building block of the CI
95% CImean ± t × SEM”Where is the true mean likely to be?”YesComparing conditions, claiming one is higher than another

The same five-specimen data, plotted three ways:

The same shear-strength data at 200, 250 and 300 °C shown as (a) mean ± SD bars, (b) mean ± SEM bars and (c) individual points with mean ± 95% CI.

At 200 °C (n = 5): SD = 0.90 MPa, SEM = 0.40 MPa, 95% CI = ±1.12 MPa. Same data, error bars that differ by almost a factor of three.

The SEM panel looks the most convincing, which is exactly why it is so often chosen and why careful reviewers distrust it. With small n, the CI is wide because the t multiplier is large:

nt (95%, two-sided)95% CI half-width
34.304.30 × SEM
52.782.78 × SEM
102.262.26 × SEM
302.052.05 × SEM

With n = 3, an SEM bar is less than a quarter of the 95% CI half-width. Showing SEM with n = 3 is the most common way small studies look more certain than they are.

What n really means in materials testing

The bar is only meaningful if n counts independent samples, meaning things that could have come out differently because of the process you are studying.

SituationReal nNot n
5 sintered joints, each sheared once5—
10 Vickers indents on one pellet1 pellet (the 10 indents describe within-sample scatter)10
3 XRD scans of the same powder13
3 batches × 4 specimens each3 batches (or 12 with batch as a factor)12 independent samples, unless batches don’t differ
Resistivity at 5 points on one film1 film5

Cumming and co-authors make the same point for biology: error bars and statistics should be based on independent repeats, not on repeated measurements of the same sample [1]. If you only have one specimen per condition, say so, and show the measurement scatter as exactly that, not as process reproducibility.

Don’t judge significance from overlapping bars

Two common beliefs are both wrong:

  • “The bars overlap, so the difference isn’t significant.” Overlapping SD or CI bars can still correspond to a significant difference.
  • “The SEM bars don’t overlap, so it’s significant.” Non-overlapping SEM bars can still have P > 0.05, especially with small n.

Krzywinski and Altman’s survey [2] shows how often experienced researchers get this wrong. If your claim is “300 °C gives higher strength than 250 °C”, run the test (for example a t-test for two conditions, or one-way ANOVA with a post-hoc test such as Tukey’s for several), and report the test, the P value and n.

Bars or dots?

  • Bar charts must start at zero. The bar’s length encodes the value, so a bar from 10 to 23 MPa exaggerates differences.
  • Dot plots (each specimen as a point, plus mean ± CI) can zoom in on the data range, show outliers and clusters, and work best for n below about 10–15. This is what Weissgerber et al. recommend for small samples [3].
  • Box plots work for larger n (above about 15–20 per group).
  • Brittle materials (ceramics, glass): strength is usually not normally distributed, so report Weibull statistics (characteristic strength and Weibull modulus) following the relevant standard, for example ASTM C1239 for advanced ceramics, rather than mean ± SD.
  • Properties spanning orders of magnitude (resistivity, conductivity, lifetime): use a log axis and consider geometric means.

Make the plot (and the numbers) in one step

dotplot_ci.py reads a CSV with one column per condition and one row per independent specimen. It draws each point with mean ± 95% CI at single-column width (PNG at 600 dpi, plus editable SVG), and prints the table you need for the text:

python dotplot_ci.py shear.csv "Shear strength (MPa)"

group         n     mean      SD     SEM            95% CI
200 °C        5    11.44    0.90    0.40   [10.33, 12.55]
250 °C        5    17.64    2.18    0.98   [14.93, 20.35]
300 °C        5    22.96    1.60    0.72   [20.97, 24.95]

The core of it is only a few lines:

from scipy import stats
n = len(x); m = x.mean(); sd = x.std(ddof=1)       # ddof=1: sample SD, not population SD
sem = sd / n ** 0.5
half = stats.t.ppf(0.975, n - 1) * sem              # 95% CI half-width
ax.scatter(i + jitter, x)                           # every specimen
ax.errorbar(i + 0.3, m, yerr=half, fmt="o", capsize=3)

A common silent error: numpy.std() uses ddof=0 (population SD) by default, which gives a smaller SD for small n. Use ddof=1, or pandas’ .std(), which already does.

How to write it

Caption:

Shear strength of joints sintered at 200–300 °C. Points show individual joints; markers and bars show the mean ± 95% confidence interval (n = 5 joints per condition).

Values are mean ± SD of five specimens per condition, each from a separate sintering run.

Experimental (statistics paragraph):

Five specimens were tested per condition, each prepared in a separate sintering run. Results are reported as mean ± standard deviation, and differences between conditions were evaluated by one-way ANOVA followed by Tukey’s post-hoc test (significance level P < 0.05).

Checklist

  • The caption says SD, SEM or CI, and what n is (specimens, batches or measurements).
  • n counts independent specimens or batches, not repeated measurements.
  • With n below about 10, the individual data points are visible.
  • Bars start at zero, or a dot plot is used.
  • Claims of “higher” or “better” are backed by a test, P value and n, not by bar overlap.
  • SD is calculated with ddof=1.
  • Brittle strength uses Weibull statistics; log-scale data use a log axis.

Related: Colour in scientific figures, How to write the Experimental section and How to write figure captions.

References

  1. G. Cumming, F. Fidler, D. L. Vaux, “Error bars in experimental biology,” Journal of Cell Biology 177(1), 7–11 (2007). doi:10.1083/jcb.200611141
  2. M. Krzywinski, N. Altman, “Points of significance: Error bars,” Nature Methods 10, 921–922 (2013). doi:10.1038/nmeth.2659
  3. T. L. Weissgerber, N. M. Milic, S. J. Winham, V. D. Garovic, “Beyond bar and line graphs: time for a new data presentation paradigm,” PLoS Biology 13(4), e1002128 (2015). doi:10.1371/journal.pbio.1002128

Figures and text, done properly:

  • The MatSci Figure Kit has grouped bar charts with error bars, value labels and hatching for greyscale print, plus nine other materials figure types at journal sizes.
  • The Manuscript Template Kit has ready-made statistics and Experimental sentences for 15+ techniques.
#Publication Figures#Data Visualization#Python#Paper Writing
SOFTWARE

Related Posts