Skip to content

Seeing relationships

Scatter plots, overplotting and its fixes, trend lines, and why you must look before you summarize.

Introductory ~10 min7 steps

You will be able to

  • Fix overplotting with transparency, binning or density
  • Explain why a summary can't replace a scatter plot
  • Scan many variables with a pair plot or heatmap

Read first

01

Look before you summarize

Read

These datasets share nearly the same means, SDs and correlation. Move the slider from the cloud to each target and watch the summaries barely change as the picture does.

CExplorable · Same statistics, different pictures

How can datasets with identical summaries look nothing alike?

As the cloud morphs into this shape, what happens to Pearson's r?

How sure?

Target

1.00

Mean, SD and correlation are held fixed along the way.

Mean of xSD of yPearson rSpearman ρ
54.3026.90−0.060−0.029

Commit your prediction above to see the result

Make your prediction first; the figure appears when you commit.

Make your prediction to see the result.

A correlation is one number. A scatter plot can show a curve, clusters, outliers or a shape no single number captures.

02

Too many points

Predict

Predict first

A scatter plot has 100,000 points drawn at full opacity. What can you read about where most of the data sit?

A dense central clusterA faint uniform cloudYou can't tell where most points are
Reveal

The answer: You can't tell where most points are

Very little. Points stack up, so one point and a thousand points look the same. This is overplottingOverplottingWhen points in a chart stack on top of each other, so one point and a thousand look the same and rare edges look as big as the core., and it makes the rare edges look as important as the dense core.

03

Fixes

Explore

Compare these on the same data in Charts, using Reshuffle demo to test a few datasets:

  • Hexbin and 2-D histogram count points per cell.
  • 2-D density contours smooth the counts.
  • Large-n scatter (canvas) draws many points with transparency.
HexbinWhere do many points concentrate in two dimensions, without the square-bin artifacts?
View data
distance_kmfare_usd
8.44023.450
1.3207.040
5.57018.700
11.56022.770
2.45025.270
11.70032.910
9.43023.770
1.66024.330
1.1505.540
4.37010.860
10.91035.390
14.86040.880
1.7206.890
2.5708.630
14.44037.800
4.82015.830
4.07013.560
4.86015.450
6.31017.660
8.41022.850
10.80027.870
4.29013.180
8.55024.260
2.2808.760
3.76012.620
2.9707.910
1.9808.160
3.73013.170
2.88010.150
2.87010.770
2.30023.060
1.9005.480
11.64038.790
6.02019.170
2.65010.290
3.94013.420
2.5906.110
1.2205.730
24.18059.400
1.4708.410
0.73004.800
4.06011.880
3.70015.360
4.54012.090
4.32014.910
2.3009.720
7.34015.490
2.72025.790
3.53010.230
5.53016.560
13.37029.550
5.41018.700
0.66004.600
3.24010.810
8.89024.690
3.06024.520
4.48012.320
24.34056.300
6.76021.700
8.35025.130

First 60 of 5000 rows.

Binned charts lose individual outliers. To see those too, show them on top.

05

Many variables at once

In the app

A Pair plot draws every pair. A Correlation heatmap shrinks that to color. Use the heatmap to find pairs worth plotting, then plot them, since the heatmap can't show a curve.

Open the Correlation heatmap with Use my data on a table of yours. Pick the strongest pair and draw its scatter.

Correlation heatmapWhich numeric variables move together, and how strongly?
View data
income_kmonthly_spendtenure_monthssite_visitschurn_risksupport_ticketsage
80.930780.2634.08034.8500.18002.28032.190
47.270461.2519.96017.3300.41001.20034.480
95521.3244.61024.3000.38002.80052.640
95.540586.0915.32018.0700.58004.39043.750
50.310543.2129.97017.4900.34001.44050.340
91.180674.8517.87025.2700.35002.70029.910
81.700545.9827.18014.0200.35002.73042.510
29.490319.705.1607.7000.55003.70056.400
19.100314.1925.93016.9300.27005.98033.040
57.250511.9433.10029.0300.40003.73041.990
86.670567.0135.29028.6400.39000.800059.170
87.070735.23−9.26014.6900.62005.70047.630
37.850213.549.19020.3000.47005.97049.180
47.320422.6916.83022.8100.34003.50049.840
97.670830.0428.34022.5300.22002.86036.090
54.480409.6229.57019.0600.49002.18045.740
61.230654.4452.78026.1100.24002.38044.130
76.080648.1746.35022.4000.25003.62040.060
64.910570.3329.69014.8600.43003.40047.290
80.450539.3227.72019.4400.16002.75035.610
102.86741.7748.44021.5500.16002.36078.900
69.970369.2525.41012.5500.45003.75055.480
95.010552.4210.85019.5700.41006.20030.310
63.690461.6021.75021.8800.34003.05055.910
60.500494.6818.40025.9900.50000.640038.830
46.610601.9429.41016.1500.33001.85045.970
44.760429.0846.50017.0700.30005.14039.360
70.490464.4927.08018.5900.41005.13060.150
54.720275.7729.10016.0900.41006.75047.780
61.250438.5715.27011.2100.46004.30036.610
48.210512.9349.55020.8000.34003.18035.480
32.800449.1823.48015.0600.51004.04041.050
89.020550.964.94015.4000.49005.39031.200
74.990574.9326.60016.9900.45002.10035.990
67.050448.2845.51022.4600.35003.54053.600
78.700622.64−3.80023.0200.54005.72035.440
45.410477.037.73018.7900.44003.20029.950
39.300520.8552.96018.2300.37001.36026.920
123.55813.5534.43032.1300.09002.44037.210
43.770395.3528.42021.1600.32003.14058.220
22.950254.4216.85012.2400.47005.19022.720
57.680491.689.91021.6900.43005.47043.110
55.730593.4915.80016.2200.47003.26045.730
51.720511.7940.13021.9300.21004.82026.720
64.070466.4811.5809.5300.66004.04014.300
33.160476.9633.25012.0600.51003.79046.760
66.850688.5461.86025.5900.27001.74056.240
55.790509.9855.80021.4300.24002.69042.950
54.110532.3228.60022.4500.54003.96033.850
79.290587.2048.12026.5700.10001.37033.010
95.640772.6223.15025.7100.34001.13056.280
71.930524.4512.02017.8300.45002.24047.710
17.270158.8438.32020.4600.23003.95057.810
70.720445.3629.12018.0400.20001.80039.940
91.290563.83−6.96013.7400.64004.55019.740
62.140422.8127.23012.5300.34005.57038.320
52.110505.4618.11017.2600.44004.09045.020
94.160754.5813.85021.3200.34004.51034.180
68.950609.4851.99017.9600.21002.84030.840
100.4365332.33013.4500.38002.78060.990

First 60 of 400 rows.

06

Check your understanding

Checkpoint

Check yourself

You have 2 million rows. Which is a good way to see a relationship?

Show the answer

Answer: a

Counting per cell shows where the mass is. Larger points make overplotting worse.

Check yourself

Two scatter plots have identical correlation, means and SDs. What must be true?

Show the answer

Answer: c

That's the point of Anscombe's quartet and the Datasaurus. Summaries don't determine the picture.

07

Recap

Recap
  • A summary can't stand in for a scatter plot.
  • With many points, bin or smooth to see the mass.
  • Scan with a heatmap, then look at the pairs that matter.

Concepts in this lesson