What is a Scatter Plot?
A scatter plot displays individual data points on a two-dimensional plane, with X and Y coordinates representing two numeric variables. Each point represents one observation, making scatter plots the go-to chart for exploring relationships between paired variables.
Unlike charts that summarize a single variable, a scatter plot keeps every (X, Y) pair visible, so you can judge not just whether two variables move together, but how — linearly, along a curve, in clusters, or not at all. It is the standard first step before computing a correlation coefficient or fitting a regression model.
This tool adds two workhorses of regression analysis on top of the raw plot: the ordinary least squares (OLS) trend line and the R² value, so you can move from a visual impression to a quantified fit in one step.
Interpreting Patterns
- Upward trend = positive correlation — as X increases, Y tends to increase.
- Downward trend = negative correlation — as X increases, Y tends to decrease.
- Random cloud = little to no linear correlation.
- Curved pattern = non-linear relationship — a straight line (and Pearson's r) will understate it.
- Isolated points far from the cloud = outliers or high-leverage points that can dominate the regression.
- Separate clusters = possible subgroups — consider splitting the data and analyzing each group.
Worked Example: Study Hours vs. Exam Score
Load the Study Hours vs Score sample: X = hours studied (1–10), Y = exam score (45–82). The points rise from lower-left to upper-right with moderate scatter — a clear positive relationship.
The OLS line has a slope of roughly 4 points per hour: each additional hour of study is associated with about a 4-point score increase. The intercept (~48) is the predicted score for zero hours of study. R² ≈ 0.9 means about 90% of the variation in scores is explained by study hours — a strong fit for social-science data.
To sanity-check the slope by hand, pick two points on the line, say (2, 55) and (8, 79): slope = (79 − 55) / (8 − 2) = 24 / 6 = 4. Note what the plot cannot tell you: whether studying caused the scores. Motivated students may both study more and score higher for other reasons.
Common Misreadings
- Correlation ≠ causation. Ice cream sales correlate with drowning deaths; a third variable (summer) drives both.
- Trusting r without plotting. Anscombe's quartet shows identical statistics can hide curves, outliers, and single-point leverage.
- Extrapolating the line. The regression line is only reliable within the observed X range.
- Ignoring R² context. R² = 0.3 may be strong in psychology but weak in physics; judge against your field's norms.
- Over-reading small samples. With a handful of points, one stray observation can flip the slope sign.
Frequently Asked Questions
What does a scatter plot show?
How is the regression line calculated?
What is the difference between correlation and causation?
What does R² tell me?
Why should I always plot before trusting a correlation coefficient?
Key Terms
- Correlation
- Measures the strength and direction of the linear relationship between X and Y.
- Independent Var (X)
- The variable that is manipulated or controlled.
- Dependent Var (Y)
- The variable that is measured or observed.
- Regression Line
- A best-fit line through the scatter points, showing the trend.
Computation Method
- Quartiles are calculated using linear interpolation (method 7 from Hyndman & Fan, 1996), consistent with Python's NumPy and pandas defaults.
- Outlier detection uses the Tukey fences method: lower fence = Q1 − 1.5 × IQR, upper fence = Q3 + 1.5 × IQR.
- Chart scaling caps the display axis at the upper fence value so the visualization remains clear even when extreme outliers are present.
References
- Pearson, K. (1895). "Note on Regression and Inheritance in the Case of Two Parents." Proceedings of the Royal Society of London, 58, 240–242.
- Anscombe, F. J. (1973). "Graphs in Statistical Analysis." The American Statistician, 27(1), 17–21.
- Tufte, E. R. (2001). The Visual Display of Quantitative Information. 2nd ed. Graphics Press.