Matrix plot: scatterplots of many variables at once

Updated

A matrix plot, also called a scatterplot matrix, draws a scatterplot for every pair of variables in a grid. With four variables you get six distinct pairs on one page, all sharing consistent axes, so you can scan for relationships, curves, clusters and outliers before choosing what to model. It is the natural first look at a dataset with several process inputs and one or more outputs.

When to use it

  • You have process records with three to about eight numeric variables and want to see which ones move together.
  • You are about to fit a regression and need to know which inputs relate to the output, and whether the inputs relate to each other.
  • You want to find points that look ordinary on each variable alone but odd in combination.
  • You need a visual check on a table of correlations, which can hide curves and outliers.

How it works

For k variables, the plot is a k × k grid:

  • The panel in row i and column j is the scatterplot of variable i (vertical axis) against variable j (horizontal axis).
  • All panels in a row share the same vertical scale, and all panels in a column share the same horizontal scale, so one point can be traced across the grid.
  • The diagonal holds the variable names, or a histogram of each variable.
  • Each panel above the diagonal is the mirror image of one below it. Many plots show only the lower triangle, which holds the k(k − 1)/2 distinct pairs: 6 for 4 variables, 15 for 6, 28 for 8.

Options often include a fitted line in each panel, different symbols for a grouping variable, and showing one output against several inputs in a single row instead of the full grid.

Example

A molding cell's records list the settings and the average part weight for 10 production runs. The settings were adjusted by operators over several weeks, not by a designed experiment.

RunMelt temperature (°C)Hold pressure (bar)Cooling time (s)Part weight (g)
122866017.424.19
223266015.124.22
323461015.824.04
422458015.623.87
523566016.024.34
623255018.023.82
723566015.524.32
823259012.924.00
923765016.224.35
1022453016.123.56

The matrix plot of these four variables has six panels in its lower triangle. The correlations behind them:

Melt temperatureHold pressureCooling time
Hold pressure0.59
Cooling time−0.09−0.06
Part weight0.760.96−0.09

Reading the panels:

  • Weight against hold pressure is a tight, straight band rising to the right (r = 0.96). Run 10, at 530 bar, gave the lightest parts (23.56 g); the runs at 650 to 660 bar gave the heaviest.
  • Weight against melt temperature also rises (r = 0.76), but with more scatter.
  • Hold pressure against melt temperature, the panel engineers most often skip, rises too (r = 0.59). Runs with hotter melt also tended to run higher pressure, probably because operators adjusted both when parts came out short.
  • Every panel with cooling time is a shapeless cloud. Over 12.9 to 18.0 s, cooling time shows no relation to weight or to the other settings.

The third panel is the important one. Because temperature and pressure moved together in these records, part of the apparent temperature effect on weight may be the pressure effect showing through, or the reverse. The data cannot separate them. A small factorial design that sets temperature and pressure independently would.

How to read the results

  • Scan the row of the output first. It shows which inputs relate to the response and in what shape.
  • Then scan the panels among inputs. Strong relations between inputs (collinearity) make their separate effects hard to estimate, in a regression or by eye.
  • Look for curves and clusters that a correlation coefficient would not show.
  • Trace unusual points. A point that stands out in one panel can be followed along its row and column to see whether it is unusual elsewhere too.
  • Mind the scales. Each panel is scaled to its own variables; a steep-looking slope is not necessarily a large effect.

Common mistakes

  • Too many variables. With 12 variables, the grid holds 66 small panels and none is readable. Pick the candidates first, or use a correlogram to screen.
  • Skipping the input-against-input panels. That is where confounding shows.
  • Concluding cause from records. Relationships in historical data may come from how people ran the process. Confirm with an experiment.
  • Ignoring overplotting. Many identical settings stack into single dots and hide how much data each point carries.

Frequently asked questions

What is the difference between a matrix plot and a correlation matrix?

A correlation matrix gives one number per pair. A matrix plot shows the full scatterplot for each pair, so you can see curves, clusters and outliers that the number hides. Use both together.

How many variables can a matrix plot show?

About eight at most on a page. Beyond that, the panels become too small to read.

Why are the panels above and below the diagonal the same?

They show the same pair with the axes swapped. Many plots draw only the lower triangle to save space.

What should I do when two inputs are correlated?

Recognize that the data cannot separate their effects. Either collect data in which they vary independently, ideally with a designed experiment, or treat them as one combined factor in the analysis.

Try it with your own data

StatLab SPC is free, open-source statistics for engineers. It runs in your browser, works offline, and never uploads your data.

Open StatLab