Statistics & data

Error bars & acceptable lines

Check a line against measurement uncertainty bars.

Your measurements

Number formats & units

Use decimal dots in datasets. Single values also accept decimal commas and scientific notation such as 1.2e-3 or 1.2 × 10⁻³.

Error Bar Graph & Maximum Minimum Gradient Calculator inputs
Four numerical columns per row; up to 80 rows. Use 0 for negligible x uncertainty. Two columns are also accepted and mean zero uncertainty.

Calculated locally. No account or uploads.

Result & working

Example

The calculator is loading. You can read the worked example below.

Copy & export

Formula & example

The relationship

y=mx+cy=mx+c
∣yi−(mxi+c)∣≤Δyi+∣m∣Δxi\left|y_i-(mx_i+c)\right|\leq\Delta y_i+|m|\Delta x_i
Δm=mmax⁡−mmin⁡2\Delta m=\frac{m_{\max}-m_{\min}}{2}Δc=cmax⁡−cmin⁡2\Delta c=\frac{c_{\max}-c_{\min}}{2}
What the variables mean
SymbolMeaning
Δx,  Δy\Delta x,\;\Delta yAbsolute measurement uncertainty; each bar extends this far on either side.
m,  cm,\;cGradient and vertical intercept.
BoundsExtrema over all straight lines intersecting every rectangular uncertainty region.

Worked example

Data: x y Δx Δy
1 2.1 0.02 0.2 2 4.0 0.02 0.2 3 6.1 0.02 0.2 4 8.0 0.02 0.2
Line check
Find acceptable bounds
X-axis label / unit
x / s
Y-axis label / unit
y / m

Y = 1.98 X + 0.1

Follow the example steps
  1. Fit the central values with ordinary least squares: Sxy/Sxx = 9.9/5 = 1.98.
  2. c = ȳ − mx̄ = 5.05 − (1.98) × 2.5 = 0.1.
  3. For every point require |y − (mx+c)| ≤ Δy + |m|Δx. Solve all constraints together, considering positive and negative gradients separately.
  4. All-rectangle gradient bounds: 1.809211 to 2.128378. Δm = (2.128378 − (1.809211))/2 = 0.1595839.
  5. Optimize intercept separately over all feasible lines: c_min = -0.2709459, c_max = 0.5269737; Δc = 0.3989598.
  6. Half-range relative to the magnitude of the OLS gradient: 0.1595839 / |1.98| × 100 = 8.059794%. This does not imply that the OLS line is acceptable.

Common mistakes

Test the line against the uncertainty range at every point.

Incorrect approach

x = 2, y = 5 ± 0.2; y = x ⇒ 2 < 4.8

Correct approach

x = 2, y = 5 ± 0.2; y = 2x + 1 ⇒ 5

More checks before you submit
  • Uncertainty bars are not automatically standard deviations. State their meaning.
  • A least-squares line need not intersect every bar.
  • Do not force a fit through the origin without a physical reason.
  • Automatic bounds help you check a graph; practice constructing the lines by eye for assessment.
Method notes

Use this to practice drawing acceptable lines and checking every uncertainty bar. With x uncertainty, a line may intersect the rectangle away from its centre. This tool uses rectangular bounds, not a probability ellipse.

Maximum/minimum gradients are found by intersecting linear constraints separately for positive and negative slopes. Intercept bounds are optimized separately: the lines with extreme slope do not necessarily have extreme intercept. The midpoint and half-range summarize bounds; an off-centre best fit is better reported with asymmetric limits.

No acceptable line means these bars and a straight-line model are mutually inconsistent under this criterion. Do not automatically delete points or enlarge bars. If horizontal bars overlap too much, slope bounds can be unbounded; the tool reports this explicitly.