FormatFlow

No tool matches “”

Try a format (“webp”, “mp3”) or a verb (“merge”, “compress”).

Loading index

↵to open

how-to · 5 min read

Polynomial fits and multi-series plots

A polynomial fit can follow curvature that a straight line misses, but every extra degree also buys flexibility to follow noise. The same trade-off appears when several data series share one chart: overlaying series makes comparisons convenient, while making it easier to compare the wrong things.

This guide covers the least-squares polynomial fits in the experimental data plotter, how to choose a degree, how to recognise overfitting and unreliable extrapolation, and how multi-series charts and per-series fits should be read and reported.

What a polynomial fit actually minimises

A least-squares polynomial chooses coefficients that minimise the sum of squared vertical distances between the data points and the curve. Degree 1 is the familiar straight line, degree 2 adds an x² term and can bend once, degree 3 adds x³ and can bend twice, and degree 4 adds x⁴. The plotter reports the coefficients, r² and the number of points, so the curve can be checked rather than trusted.

Adding a term can never increase the sum of squared errors, so r² rises with degree almost automatically. That is why r² alone cannot choose a model: a degree-4 fit will beat a straight line on r² even when the extra terms are only following noise.

Choosing a degree without fooling yourself

Start from the physics, chemistry or instrument response: an exponential-like curve over a narrow range may look quadratic, a calibrated detector may have a quadratic response, and a straight line is often the correct model for a calibration. Plot the points before fitting, then compare adjacent degrees and keep the lowest one that captures a real pattern rather than small wiggles.

A small worked example shows the arithmetic. Four points at (−1, 6), (0, 1), (1, 2) and (2, 9) are fitted by the quadratic y = 3x² − 2x + 1, which passes through all four with r² = 1. Three points would determine the same parabola uniquely, so the fourth point is genuine support for the shape rather than a constraint; with only three points, r² = 1 would prove nothing.

A fit with as many points as coefficients passes through every point and reports r² = 1 by construction; that is arithmetic, not evidence. State the degree, the number of points and the x range with the equation, because a fit is only meaningful inside the range that was measured.

Overfitting and extrapolation

High-degree polynomials are flexible enough to bend between points, so they can fit noise beautifully and still predict badly. A useful check is to remove one point, refit and see whether the curve changes shape near that point: a stable fit changes little, while an overfitted curve can swing wildly.

Polynomials also behave badly outside the data range, where the highest term grows fastest. Extrapolating a fitted parabola past the measured x values is not an estimate of the real trend, and extrapolating a quartic is almost always indefensible.

Putting several series on one chart

The plotter's multiple-series mode takes one point per line as series, x, y or series, x, y, error; rows with the same series name are grouped, and series names may repeat across rows. Each series is drawn with its own marker and line style, the legend names them, and the CSV keeps the series column so the grouped data can be checked afterwards.

Overlay series only when they share units and comparable conditions, and avoid so many series that the markers blend together. When one series has a much larger scale, separate charts are clearer than shared axes that compress the small series; when fits are enabled, the fit results table lists each series separately.

Reporting polynomial and multi-series results

For every fitted series report the degree, the equation, r² and n, and say why that degree was chosen. Do not quote r² from a fit through n = degree + 1 points as if it measured quality, and do not compare r² across data sets with different ranges as if it ranked their models.

In the figure caption, state which markers and lines belong to which series, what the error bars represent, and whether a curve is a fit or a guide to the eye. That information is what lets a reader judge the claim instead of just looking at a tidy chart.

  • Fit the lowest degree that follows a justified pattern.
  • Report degree, equation, r², n and the measured x range.
  • Treat r² = 1 with n = degree + 1 as arithmetic, not evidence.
  • Do not extrapolate a polynomial past the measured range.
  • Keep series on one chart only when units and conditions are comparable.

Frequently asked questions

How do I choose between a linear, quadratic and cubic fit?
Start from the relationship the experiment should follow, then compare adjacent degrees on the plotted points. Keep the lowest degree that captures a real pattern, check that the residuals do not show a clear remaining trend, and remember that a higher degree always raises r², so r² alone cannot justify the extra terms.
Why is r² equal to 1 with three points and a quadratic fit?
Three points determine a parabola exactly, so the least-squares solution passes through all three and the residuals are zero by construction. That is arithmetic, not evidence of a quadratic relationship; add points spread across the range before judging the curve.
Should I extrapolate a polynomial fit?
No, not as a prediction. Outside the measured range the highest power dominates, so a fitted parabola or quartic can turn sharply away from the real trend. If extrapolation is unavoidable, use a model justified by the mechanism and report it as an assumption rather than a measured result.
How do I compare several series on one chart?
Switch the plotter to multiple series and paste series, x, y rows so each condition is grouped and labelled. Use distinct markers and line styles, keep the axes shared only when the units and scale are comparable, and report each series' fit separately rather than fitting one curve to all the points.
Can a polynomial fit replace a calibration curve?
Usually a straight line is the right calibration model over a validated range, and a higher-degree fit should only be used when the detector response is genuinely curved and has been validated. Whatever the degree, a calibration applies only inside the measured standard range.

Tools for this job

All Scientific Tools