Scatter plot calculator
For the points (1, 2), (2, 4), (3, 5), (4, 4) and (5, 5), the line of best fit has a slope of 0.6 and an intercept of 2.2, with a correlation of about 0.775. Enter your pairs to get these values and the equation. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
A scatter plot of paired x and y values is the first picture most students and analysts draw when they want to see whether two measurements move together. This scatter plot calculator takes those pairs, computes the Pearson product-moment correlation coefficient that summarizes the linear cloud, and fits the ordinary least-squares regression line that classrooms call the line of best fit. You receive the correlation r, the slope m, and the intercept b of y equals m times x plus b, plus the sample size, the two means, the centered sums, a printable equation, and the closed-form reminder used to produce them.
How a scatter plot yields correlation and a line of best fit
Begin with at least two paired observations of a horizontal coordinate x and a vertical coordinate y. Pearson’s product-moment correlation r measures how tightly the cloud hugs a straight line: it is the centered product-moment Sxy divided by the square root of Sxx times Syy, and it always lies between negative one and positive one when both series have positive variance. The same centered sums produce the ordinary least-squares line of best fit.
The slope m equals Sxy divided by Sxx, the change in y you expect for a one-unit rise in x. The intercept b equals the mean of y minus m times the mean of x, the fitted height of the line when x is zero. Together they write the familiar classroom equation y equals m x plus b that you can sketch through the cloud or drop into a later prediction step.
If every x value is the same, Sxx vanishes and no finite slope exists; if every y value is the same, correlation is undefined. A single point cannot determine a unique line or a correlation, so fewer than two pairs also fail. Those rules match the language of introductory statistics: you need spread in both directions before a scatter-plot analysis is meaningful.
What you can do with it
Homework and exam answer keys
Generate Pearson r, slope, and intercept for textbook scatter-plot tables so teachers and auto-graders share one ground truth.
Lab calibration clouds
Summarize instrument reading versus concentration with both the correlation of the cloud and the least-squares line used for later prediction.
Quick trend checks in ops and product
From weekly driver-versus-volume pairs, return r, m, and b in one call without a full analytics stack.
FAQ
How does this scatter plot calculator compute correlation?
It uses Pearson’s product-moment r: Sxy divided by the square root of Sxx times Syy, from the same centered sums that produce the least-squares line. r is undefined when x or y has zero variance.
How is the line of best fit computed?
The printed equation is y = m*x + b. No iterative solvers and no machine-learning libraries.
What happens if I send fewer than two points?
A single pair cannot determine a unique line or a correlation; at least two finite (x, y) points are required.
What if every x value is the same, or every y value is the same?
Zero variance in x makes the slope undefined; zero variance in y makes Pearson r undefined. Add spread in the flat direction.
What does the scatter plot calculator cost?
The browser tool is free and runs locally.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/math/scatter-plot \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"points":[{"x":1,"y":2},{"x":2,"y":4},{"x":3,"y":5},{"x":4,"y":4},{"x":5,"y":5}]}'const res = await fetch("https://api.kit.forhosting.com/math/scatter-plot", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"points": [
{
"x": 1,
"y": 2
},
{
"x": 2,
"y": 4
},
{
"x": 3,
"y": 5
},
{
"x": 4,
"y": 4
},
{
"x": 5,
"y": 5
}
]
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/math/scatter-plot",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"points": [
{
"x": 1,
"y": 2
},
{
"x": 2,
"y": 4
},
{
"x": 3,
"y": 5
},
{
"x": 4,
"y": 4
},
{
"x": 5,
"y": 5
}
]
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/math/scatter-plot", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"points":[{"x":1,"y":2},{"x":2,"y":4},{"x":3,"y":5},{"x":4,"y":4},{"x":5,"y":5}]}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"points":[{"x":1,"y":2},{"x":2,"y":4},{"x":3,"y":5},{"x":4,"y":4},{"x":5,"y":5}]}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/math/scatter-plot", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"points": [
{
"x": 1,
"y": 2
},
{
"x": 2,
"y": 4
},
{
"x": 3,
"y": 5
},
{
"x": 4,
"y": 4
},
{
"x": 5,
"y": 5
}
]
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "math.scatter_plot",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
max_n | 10000 |
max_abs | 1000000000000000 |
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
Send at least two finite points; fewer than two pairs, missing coordinates, non-finite numbers, or a series with zero variance in x or in y fail with invalid_input and are not billed. Successful API calls cost $0.002.
How a scatter plot yields correlation and a line of best fit
The method is closed-form floating-point arithmetic with no random seeds, no wall-clock timestamps, and no network calls, so identical points always produce identical JSON. Both cases are rejected with invalid_input rather than Infinity or NaN.
What you send and what you get back
Do not send fewer than two pairs. Classic textbook checks include the five pairs (1, 2), (2, 4), (3, 5), (4, 4), (5, 5), which yield slope 0.6, intercept 2.2, and correlation about 0.775; and the perfect line through (0, 1), (1, 3), (2, 5), which yields slope 2, intercept 1, and correlation 1. Pin correlation, slope, and intercept in tests so a later rounding change cannot drift a grading key. Send a JSON body with one required field. points is an array of at least two records, each an object with finite numeric x and y, or a two-element [x, y] pair; a JSON string of the same array is also accepted, and the aliases data, pairs, and xy are honored when wiring forms or scripts. Missing points, an empty list, a single pair, non-numeric tokens, NaN, Infinity, magnitudes above one quadrillion, more than ten thousand pairs, identical x values, and identical y values all fail with invalid_input and are not charged. On success the body reports n, correlation, slope, intercept, mean_x, mean_y, the centered sums sxx, syy, and sxy, a printable equation string such as y equals m times x plus b, and a short formula reminder. Pricing for successful API calls is the published base of $0.002 per item; validation failures do not consume prepaid balance.
Where scatter-plot analysis shows up in real work
Laboratory notebooks plot instrument reading against concentration or time against a measured response and need both the tightness of the cloud and the fitted line for later prediction with the same numbers every lab section sees. Business and operations teams glance at weekly volume versus a driver, or latency versus load, and want the slope, intercept, and correlation in one shot rather than two separate tools. Keep n inside the published limits, pin the three headline numbers in tests, and you get a reproducible scatter-plot summary for homework, labs, and edge workers. Secondary-school and college statistics courses constantly assign scatter plots, interpret-the-correlation drills, and draw-the-line-of-best-fit word problems; a single trusted oracle that returns r, slope, and intercept as clean JSON speeds grading and demo setup without opening a full notebook. Because this capability is a pure parse engine, API pricing is the published base of $0.002 per successful item and failed validation does not consume balance. This landing targets people searching for a scatter plot calculator, a line of best fit, or correlation and regression from paired points. It is not a correlation-only page and not a multiple-regression or polynomial-fit tool: those are different search intents.