liveBook · Manning

Scatter plot

As explained in Statistics Every Programmer Needs

A scatterplot is a two-dimensional graph that represents paired observations as points to show relationships between variables.

A scatter plot represents paired observations as points on a two-dimensional plane, making relationships between two numeric variables visible. It supports pattern detection, relationship assessment, outlier identification, and evaluation of linear-model fit. section 4.1.1

Read a scatter plot by examining:

  • The horizontal axis for the independent variable and the vertical axis for the dependent variable; this orientation is conventional rather than mathematically required. section 4.1.1
  • The direction and form of the relationship: points may show positive, negative, or nearly neutral association. section 4.1.1
  • The distance of observations from a fitted regression line, which helps reveal unusual points and assess model fit. section 4.1.3

Eight paired observations

Plotting the pairs (152, 191), (175, 235), (179, 214), (222, 274), (202, 288), (221, 269), (239, 315), and (164, 201) shows observed x–y values alongside a fitted regression line. The point (202, 288) is highlighted as a possible outlier. section 4.1.1 section 4.1.3

Figure 4.1 A scatter plot that displays eight data points, their respective x and y coordinates, and a regression line. The data points represent the observed data (for instance, when x equals 202, y equals 288, which has been highlighted and magnified). The regression line ties back to a simple linear regression that was fit on the data, where a response variable called y, which runs along the y axis, was regressed against a predictor called x, which runs along the x axis. It represents the linear equation at the top that can be derived from the model output, which is to say, it is also a representation of the predictions for y given x. R-squared is one of several metrics contained in the model output; it represents the percentage of variance in the response variable that can be explained by changes in the predictor.
figure

Use the annotated figure to connect individual observations, their coordinates, the fitted line, predictions, and R-squared. section 4.1.1

How Statistics Every Programmer Needs covers it

How deep it goes
Explains points, axes, relationship direction, outliers, and regression fit, but does not provide the complete plotting implementation here.
Examples
Uses eight paired observations, a fitted regression line, a highlighted point, and positive, negative, and neutral relationship figures.
What it assumes
Assumes paired numeric observations and introduces independent-variable and dependent-variable roles through the axes.
What you can do after
Apply via Matplotlib to inspect paired numeric data and investigate potential outliers before fitting or evaluating regression models.
How it connects
Connects scatter plots with linear regression, residuals, outliers, correlation matrices, and R-squared.

Also explained in

Compare how 8 books explain scatter plot →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Statistics Every Programmer Needs. The section links point to the parts of the book it draws on.