A scatter plot shows the relationship between two numerical measurements. Each point represents one observation, positioned according to its values on the horizontal and vertical axes.
For example, if we plot penguin flipper length against body mass, the points generally rise from left to right. Penguins with longer flippers tend to weigh more. The pattern is visible before we calculate a correlation coefficient or fit a trend line.
But scatter plots are also useful when an apparent relationship turns out to be misleading. In the same penguin dataset, two bill measurements appear negatively correlated when we combine all species. Separate the species, and the association becomes positive within each group.
The measurements haven't changed. We've uncovered something that was hidden by grouping them together.
We’ll use simple illustrations to explain direction, curves, clusters, and unusual points, then examine real datasets in interactive Deepnote charts. We’ll also look at what correlation can tell us and when a line graph or bubble chart is a better fit.
What does a scatter plot show?
A scatter plot, sometimes called a scatter diagram or scatter graph, displays paired numerical observations on two axes.
The horizontal axis (x-axis) shows one variable, and the vertical axis (y-axis) shows another. Each point represents the two measurements for the same observation.
Suppose we're investigating whether penguins with longer flippers also tend to have greater body mass.
The Palmer Penguins dataset contains measurements from 344 penguins, including flipper length, body mass, species, and island. Of those records, 342 have both measurements available.
Each dot represents one penguin. Its horizontal position indicates flipper length in millimeters, while its vertical position indicates body mass in grams.
The points form an upward-sloping pattern. That tells us the measurements are positively associated in this sample.
A scatter plot is useful because it preserves the individual observations. We can see whether the points follow a recognizable pattern, whether separate groups exist, and whether a few unusual values stand apart from the rest.
What data do you need?
A basic scatter plot needs two numerical measurements recorded for each observation.
For example, an application performance dataset might contain one row per request, with response time and payload size in separate columns. A sales dataset might contain one row per customer account, with monthly spend and number of active users.
The observations must be paired correctly. If two columns represent different customers or reporting periods, plotting them together may create a relationship that has no meaning.
Scatter plots are particularly effective for continuous measurements, such as time, weight, distance, and monetary amounts. They can also show relationships involving numerical counts, although repeated values may cause points to overlap.
Unlike a histogram, which summarizes the distribution of one numerical variable, a scatter plot helps us examine how two variables behave together.
Scatter plot key components & parts
- Horizontal axis: Shows one numerical measurement, including its unit.
- Vertical axis: Shows the second numerical measurement and its unit.
- Points: Each point represents both measurements for one observation.
- Title and labels: Identify what is being compared and which population or period the data covers.
- Optional legend: Explains colors, shapes, or sizes used to distinguish groups or additional measurements.
- Optional fitted line: Summarizes a relationship without replacing the individual observations.
The points must preserve the original pairings. A penguin’s flipper length and body mass belong together; combining measurements from different animals would produce a meaningless comparison.
Scatter plot use cases
Use a scatter plot when you want to examine how two numerical measurements vary together.
Use case | Example comparison | What each point represents |
|---|---|---|
Application performance | Payload size and response time | One request |
Product usage | Active users and projects created during the same month | One account |
Sales analysis | Advertising spend and sales during the same period | One store |
Scientific measurements | Flipper length and body mass | One penguin |
Experimental results | Assigned dose and measured response | One experimental unit |
Quality checks | Expected and measured dimensions | One manufactured item |
A scatter plot can reveal direction, curves, clusters, and unusual observations. It does not establish why those patterns occur.
Use a histogram to examine one numerical variable, a bar chart to compare category totals, or a line graph when following an ordered sequence is the main question.
How to read a scatter plot
Start with the axes, then look at the overall arrangement of points. We usually want to understand the direction of the relationship, how closely the observations follow it, and whether anything unusual interrupts the pattern.
Positive correlation
A positive correlation appears when higher values of one variable tend to accompany higher values of the other.
In a positive correlation scatter plot, the points generally rise from the lower left toward the upper right.
The penguin flipper-length example shows this clearly. Longer flippers tend to be associated with greater body mass.
Across the 342 complete observations, the Pearson correlation coefficient is approximately 0.871, indicating a strong positive linear association.
That doesn't mean every penguin with longer flippers weighs more than every penguin with shorter ones. Individual points still vary.
Negative correlation
A negative correlation appears when higher values of one variable tend to accompany lower values of the other.
The points generally slope downward from left to right.
The simulated example below shows the pattern directly: larger x-values generally accompany smaller y-values, with some variation around that downward direction.
The illustration demonstrates negative association, not a causal relationship. Later, the penguin bill measurements show why a downward trend can also change when we examine the groups behind it.
Weak or no linear correlation
A loose cloud without a clear upward or downward direction suggests little linear association. But a near-zero Pearson correlation does not rule out a curved relationship.
These simulated examples show the difference:
The left panel has no clear pattern. The right panel forms a U-shape: y decreases and then increases as x rises. A single straight-line correlation can miss that relationship.
Look at the points before interpreting a coefficient near zero as “no relationship.”
Clusters and outliers
Clusters are concentrations of points occupying different parts of the chart.
They may correspond to groups such as customer segments, product types, geographical regions, or species.
An outlier is an observation that lies unusually far from the main pattern. It may reflect a legitimate extreme value, a measurement error, or a different process.
The simulated examples below separate these two features. One contains several concentrations of points; the other contains a point well away from the main pattern.
Why correlation doesn't prove causation
A scatter plot can show that two variables are associated. It cannot establish that changing one would cause the other to change.
There are several possible explanations for an observed correlation. One variable might influence the other, both might respond to a third factor, or the pattern might arise from the way observations were sampled or grouped.
One of the clearest examples comes from actual biological measurements.
When the overall trend reverses
The Palmer Penguins dataset contains measurements of bill length and bill depth for three penguin species.
First, we combine all 342 complete observations and plot bill length against bill depth.
The overall Pearson correlation is approximately -0.235.
Read by itself, the plot suggests a weak negative association: penguins with longer bills tend to have shallower bills.
Now let's color the same observations by species and fit a separate line within each group.
The result changes substantially.
Within Adelie penguins, the correlation is approximately 0.391. Within Chinstrap penguins, it's 0.654. Within Gentoo penguins, it's 0.643.
All three within-species correlations are positive, even though the overall correlation is negative.
This is an example of Simpson's paradox, where a trend reverses when observations are combined rather than analyzed within their groups. The authors of the Palmer Penguins paper in The R Journal demonstrate this exact relationship using bill measurements.
Species membership matters because the groups have different combinations of bill length and depth. Pooling them conceals those differences.
The lesson extends to business analysis.
Imagine finding a negative correlation between product usage and customer retention across all accounts. Before concluding that greater usage is associated with poorer retention, we would want to check whether account size, customer segment, or product tier changes the relationship.
The combined correlation might be a poor description of what happens within the groups.
How spurious correlations happen
A spurious correlation is an apparent association that doesn't reflect the causal relationship someone might infer from it.
Two measures might increase together because both are affected by another factor. They might share a long-term trend, or the relationship might arise by coincidence.
Consider a product team comparing monthly AI feature usage with subscription revenue. Both measures increase over a year.
It would be tempting to conclude that the feature caused the revenue growth. But the business may also have gained customers, introduced new pricing, or expanded into another market.
A scatter plot cannot distinguish those explanations.
We can investigate by examining customer cohorts, controlling for relevant variables, comparing periods, or designing an experiment when a causal question warrants one.
The chart gives us a reason to investigate. The evidence needed to establish causation comes from the broader study design.
Scatter plot vs. line graph vs. bubble chart
All three charts can place numerical values on axes, but they emphasize different relationships.
Scatter plot vs. line graph
A scatter plot shows how two numerical variables relate to one another. It doesn't normally connect observations because the order of the points may not be meaningful.
A line graph connects successive observations along an ordered sequence, most commonly time.
Suppose we have life expectancy estimates for India between 1952 and 2007.
A line graph makes sense because the chronological progression is the question. The dataset contains observations at five-year intervals, and the connecting line helps readers follow their sequence.
Now suppose we want to compare GDP per person with life expectancy across 142 countries in 2007.
Each country has a pair of numerical measurements. Connecting countries would imply an arbitrary sequence, so a scatter plot is more appropriate.
If your data follows a meaningful sequence and you want to examine its changes, try the line graph maker.
Scatter plot vs. bubble chart
A bubble chart is a scatter plot that uses marker size to encode another numerical variable.
The x-axis and y-axis still represent two measurements, but each bubble carries a third.
For example, we can plot GDP per person against life expectancy for countries in the Gapminder dataset, then size each point by population.
The bubble sizes reveal differences that aren't visible in a standard scatter plot. China and India, for instance, represent much larger populations than many other individual country observations.
This additional information can be useful, but it introduces another interpretation task. Readers must compare marker sizes as well as positions.
Bubble area should represent the underlying quantity proportionally. Scaling the radius directly would exaggerate the visual difference because circle area increases with the square of its radius.
Use the bubble chart maker when a third numerical measure is central to the question. Our bubble chart guide explains that distinction in more detail.
If the extra measure doesn't add useful information, ordinary scatter points are easier to read.
Trend lines and correlation coefficients, explained
A scatter plot shows the observations. A trend line adds a summary of their relationship.
The most familiar is a straight line of best fit, often calculated using ordinary least squares regression. This method chooses a line that minimizes the sum of squared vertical differences between the observed values and the line's predicted values.
A line can help summarize the overall direction. It should never replace looking at the points.
What does Pearson's r mean?
Pearson's correlation coefficient, usually written as (r), measures the direction and strength of a linear association.
Its values range from -1 to +1.
- Near +1: A strong positive linear association.
- Near -1: A strong negative linear association.
- Near 0: Little or no linear association.
The closer the absolute value of (r) is to 1, the more closely the observations follow a straight-line pattern.
There isn't a universal threshold for calling a correlation weak, moderate, or strong. Interpretation depends on the field, sample size, measurement quality, and intended use.
Pearson's r is also sensitive to outliers and nonlinear relationships.
Why you should look at the points before trusting r
In 1973, statistician Francis Anscombe constructed four small datasets with nearly identical summary statistics.
Each contains 11 observations, and each has a Pearson correlation coefficient of approximately 0.816.
Their straight-line fits are also nearly identical.
The scatter plots tell very different stories.
One dataset follows a reasonably linear pattern. Another forms a curve. A third has a prominent point that influences the fitted relationship. The fourth contains many observations at the same x-value and one point far to the right.
You couldn't discover those differences from the correlation coefficients alone.
Anscombe's quartet is a constructed statistical demonstration, not observational research data. That's why it works so well here: the summary statistics were deliberately made similar while the underlying patterns differ.
In our notebook, removing the conspicuous point from the third dataset changes its correlation from about 0.816 to 1.000. That is a sensitivity demonstration, not a reason to delete inconvenient observations.
A useful practice is to look at the scatter plot first, calculate the correlation, then inspect whether the coefficient accurately summarizes what is visible.
Does a trend line predict future values?
A fitted line describes an estimated relationship in the available data. Using it for prediction requires further assumptions.
A linear trend line may perform poorly when the relationship is curved, the sample is unrepresentative, or a prediction lies outside the observed range.
For example, the relationship between national GDP per person and life expectancy may not follow the same straight-line pattern across every income level.
A fitted line can help describe the association, but predictions and causal interpretations need additional validation.
Scatter plot examples with real data
The following examples use observations from public datasets. They show how scatter plots help us move from noticing a relationship to asking better questions about it.
Example 1: Penguin flipper length and body mass
Our first example uses Palmer Penguins measurements.
Across 342 complete observations, flipper length and body mass have a Pearson correlation of approximately 0.871.
Coloring the observations by species reveals differences that weren't as obvious in the original scatter plot. Gentoo penguins generally have longer flippers and greater body mass, while Adelie and Chinstrap penguins overlap more substantially.
The overall positive correlation remains useful, but it combines species with different typical measurements. Looking at the groups separately helps us understand what contributes to the pattern.
This is a sensible next step whenever a dataset includes a meaningful categorical variable. A strong overall correlation may combine several distinct relationships.
The plot also doesn't establish that longer flippers cause greater body mass. Both measurements are characteristics of the observed animals.
Example 2: GDP per person and life expectancy
Our second example uses Gapminder's 2007 country-level extract, containing observations for 142 countries.
We plot GDP per person on the horizontal axis and life expectancy at birth on the vertical axis.
GDP per person spans a wide numerical range, so we've used a logarithmic horizontal axis.
The scatter plot shows a positive association, but the relationship isn't perfectly linear. The observations are spread across different regions, and countries with similar GDP per person can have different life expectancies.
When we calculate Pearson's r using the base-10 logarithm of GDP per person, the coefficient is approximately 0.809.
Using untransformed GDP per person instead gives approximately 0.679.
Those numbers differ because the transformation changes the values used in the correlation calculation. Simply displaying a logarithmic axis doesn't change a correlation coefficient already calculated from the original values.
There's another important limitation: every dot represents one country, regardless of its population. The plot describes an association across country-level observations, not a population-weighted relationship across individuals.
And although the association is substantial, it doesn't establish that increasing GDP per person alone would produce a specific improvement in life expectancy.
Example 3: When a combined correlation hides the groups
The penguin bill-length and bill-depth comparison shows how combining groups can conceal the relationships within them.
The charts below use the same 342 complete observations, with identical axes. The left panel shows the pooled relationship, while the right separates the observations by species.
The pooled data has a weak negative correlation of approximately -0.235. Within each species, however, the correlations are positive. The fitted lines make this reversal visible without requiring readers to compare two separate charts.
The original observations haven't changed. What changed was our understanding of how the data is structured.
For data teams, this is a reminder to examine segments before drawing conclusions from an aggregate correlation. Customer plans, regions, acquisition channels, or product cohorts can all introduce differences that a single overall coefficient misses.
The chart helps us identify the issue. The next step is to investigate why the groups differ and whether the proposed explanation is supported by the data.
How to make a scatter plot
To make a scatter plot, start with a table containing one row per observation and two numerical columns. Choose which variable belongs on each axis, decide whether grouping or sizing adds useful context, and review the resulting points before fitting a line.
Make a scatter plot with Deepnote Agent
In Deepnote’s scatter plot maker, give Agent the dataset and comparison in one request. It can load the observations, check the measurement pairs, and create the chart.
For this example, ask it to load Palmer Penguins through Seaborn:
Load the Palmer Penguins dataset using
seaborn.load_dataset("penguins").Create an interactive scatter plot with flipper_length_mm on the horizontal axis and body_mass_g on the vertical axis. Use one point per penguin with both measurements available. Exclude records only when one of these two measurements is missing; do not discard rows because unrelated fields are missing.
Color the points by species and use moderate transparency to reveal overlap. Label the axes “Flipper length (mm)” and “Body mass (g).” Title the chart “Penguin flipper length and body mass.”
Report the number of complete pairs and the overall Pearson correlation coefficient. Add one clearly labeled linear fit for all included observations, not separate species fits. Keep the individual points visible and do not interpret the association as causal.
Identify the source as Palmer Penguins, loaded through Seaborn, and report which records were excluded and why.
The analysis should use 342 complete measurement pairs and return an overall Pearson correlation of approximately 0.871. Each point represents a penguin; plotting only the three species averages would answer a different question.
A follow-up request can investigate the grouped relationship:
Compare bill_length_mm with bill_depth_mm using complete pairs for those two measurements. Calculate Pearson’s r for all observations and separately for each species. Show the pooled plot and the species-colored plot side by side with identical axes, adding the appropriate fitted lines. Explain whether the direction changes.
The earlier bill-measurement example shows why this check matters: the overall association is negative, while the association within each species is positive. The notebook keeps the exclusions, calculations, and chart code available for the team to inspect.
Make a scatter plot in Excel
Deepnote offers a more direct workflow when the task includes checking measurement pairs, calculating correlations, and comparing groups. If your observations are already in an Excel workbook, place the paired measurements in two columns, select them, and choose a Scatter chart from the Insert tab.
Excel uses the selected columns to position the observations on the axes. You can then add axis titles, adjust marker formatting, or include a trend line.
Check that the horizontal and vertical variables are assigned correctly and that missing observations haven't been replaced with misleading zeros.
For larger datasets or plots that need grouping, interactive hover details, and repeatable calculations, a notebook can make the underlying analysis easier to inspect.