Correlation Matrix (Correlation Heatmap)

See at a glance which pairs of many variables are closely linked. The Pearson correlation of every pair is written in a heatmap cell (red = positive, blue = negative correlation), and the clearest and weakest relationships are pointed out.

1Data Table

Paste a table copied from Excel into a cell (Ctrl+V). Click a column header (A, B…) before pasting to use the first line as column names. Double-click a header to rename it, right-click to insert/delete rows and columns, and formulas such as =A1*2 work too.

2Correlation Matrix Options

Select the columns to use (at least 2, 3 or more recommended):

How to make a correlation matrix

  1. Copy the variable columns to compare together with the header (3 or more recommended).
  2. Select 2 or more columns to use.
  3. Press Analyze and check the heatmap and interpretation. Hover over a cell to see the exact value.

Worked example with sample data

The sample data are 30 rows of process data with 5 variables: temperature, pressure, line speed, thickness and strength.

Correlation matrix heatmap of temperature, pressure, line speed, thickness and strength
Correlation matrix heatmap of temperature, pressure, line speed, thickness and strength

The darkest cell is line speed vs thickness at -0.92: the faster the line, the thinner the product - a 'very strong negative correlation', and a sign that line speed is the first thing to watch when controlling thickness.

Strength is positively correlated with temperature (0.74) and thickness (0.67) and negatively with line speed (-0.62). Line speed may affect strength through thickness; such an indirect relationship can be checked with partial correlation, controlling for thickness.

Pressure has almost no correlation with any other variable (0.10-0.15; the weakest pair is temperature-pressure, r=0.0986). In this data range pressure moves independently of the other variables.

How it is calculated

Each cell is the Pearson r of the two columns. Missing values are handled pair by pair (pairwise), using only rows where both columns are numbers, so blanks in other columns do not reduce the data (the same as the default of pandas .corr()). If a column has all equal values, its cells are left empty.

Colors and the diagonal

The colors span the minimum to maximum of the matrix from blue to red. The diagonal is each variable's correlation with itself, always 1.00, and the matrix is symmetric about the diagonal.

How to read a correlation matrix

  • The interpretation names the off-diagonal pair with the largest |r| (the clearest relationship) and the smallest |r| (the most unrelated pair).
  • Before a regression, if two explanatory variables have |r| of 0.8 or more, suspect multicollinearity and consider dropping one.
  • Two highly correlated variables may in fact move together because of a third variable. If you suspect this, check with partial correlation.

Frequently asked questions

Can I get a Spearman correlation matrix?

No. It uses Pearson r. Get the rank correlation of two specific variables on the Spearman rank correlation page.

Can I see p-values?

The matrix shows r only. Check the p-value and confidence interval of a pair you care about with Pearson correlation.

I want the heatmap in a report.

Right-click the result chart to save or copy it as an image.

Other chart tools