Scatter plot maker with a least-squares trend line

Paste pairs of numbers, X first and Y after it, and the tool plots every point, fits a straight trend line through each series and prints its equation and r² in the legend.

Live demo · real result from this tool
First column: X values. Each further column: a Y series. Rows without a numeric X are skipped.

Scatter plot

Scatter plot

Points

SeriesHours studiedY
Score152
Score255
Score2.561
Score360
Score468
Score4.571
Score575
Score679
Score786
Score888

Trend lines (y = slope × x + intercept)

SeriesSlopeInterceptr²Points
Score5.53728145.6896930.985710

Processed on your device — nothing is uploaded.

How to use the scatter plot maker

  1. Paste your data into Chart data: X values in the first column, Y values after it, such as Hours studied,Score then 1,52. Add more columns for more Y series.
  2. Keep Add a linear trend line (least squares) ticked to fit a line, or untick it for points only.
  3. Set the Point size (2–14 px) and decide whether to Start both axes at zero.
  4. Fill in Chart title, X-axis title and Y-axis title, and choose a Colour theme, Background, Width and Height.
  5. Copy or download scatter-plot.svg. Below it, the Points table and the Trend lines table can be copied or saved as CSV.

What it does and when to use it

A scatter plot shows whether two measurements move together. Each row is one dot: hours of study against a test score, temperature against sales, ad spend against sign-ups. A cloud that rises from left to right suggests a positive relationship; a falling cloud, a negative one; a round blob, little linear relationship at all.

The trend line turns the eye’s impression into numbers. The slope says how much Y changes for each extra unit of X, and r² says how closely the dots hug that line. If you only need to show a series over time, the line chart maker is the better choice. To get the mean, spread and quartiles of each column first, run the data through the summary statistics calculator.

How it works

The fit is ordinary least squares, worked out per series with x̄ and ȳ as the means:

slope     = Σ(x − x̄)(y − ȳ) ÷ Σ(x − x̄)²
intercept = ȳ − slope × x̄
r²        = [Σ(x − x̄)(y − ȳ)]² ÷ (Σ(x − x̄)² × Σ(y − ȳ)²)

The dashed line is drawn only between the smallest and largest X in that series, so it never claims to predict beyond your data. Axis ticks use rounded steps of 1, 2 or 5 × 10ⁿ. Dots are slightly see-through, so overlapping points look darker.

Worked examples

Study time and scores (the sample). Ten students. The legend reads Score (y = 5.537x + 45.69, r² = 0.986): each extra hour goes with about 5.5 more points, and the line explains almost all the variation. The Trend lines table gives the full precision: Score | 5.537281 | 45.689693 | 0.9857 | 10.

A perfect line. 1,2, 2,4, 3,6 give y = 2x + 0 with r² = 1.000.

Two series and a bad row. Temperature in the first column, ice cream and hot drink sales after it, with one row whose X is “n/a”. The tool reports 1 row without a numeric X value was skipped. Ice creams rise (slope 6.084233, r² 0.9949) while hot drinks fall (slope -3.819654, r² 0.9866).

Limits and tips

  • Only straight-line fits are offered; curved patterns will show a lower r² than they deserve.
  • One outlier can pull the line a long way. Check the Points table for typing errors before trusting the slope.
  • Values like 1,234.5, $45 and 12% are read as numbers. The SVG can be turned into a PNG with the SVG to PNG converter.

Frequently asked questions

Which column is X?
Always the first column. Every further column with numbers becomes its own Y series in a different colour, each with its own trend line. A row whose first cell is not a number (such as "n/a") is skipped, and the tool tells you how many were skipped.
What does r² tell me?
How much of the up-and-down movement in Y a straight line explains, from 0 (none) to 1 (every point on the line). It describes this data only. A high r² does not prove that X causes Y.
Why is there no trend line for one of my series?
A line needs at least two points with different X values. If every point in a series has the same X, there is no slope to fit, so the line is left out.
Can the axes start at zero?
Yes, tick "Start both axes at zero". By default each axis covers just the range of your data, which spreads the points out and makes the pattern easier to see.
Is the data sent to a server?
No. The points, the fit and the SVG are all calculated in your browser.

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close