Correlation Heatmap Maker

Compute Pearson or Spearman correlations between 2–30 numeric columns, or draw a matrix you already have. Pairwise n, optional Holm or FDR-adjusted p-values and a colour-blind-safe scale fixed at −1 to 1.

Loading the heatmap editor…

Worked examples

Engineering data (R mtcars)

car design and fuel economy

Pearson r for 11 variables measured on 32 cars; the lower triangle shows each pair once.

Environmental data (R airquality)

air quality with missing values

Spearman ρ for daily ozone, solar radiation, wind and temperature; * marks Holm-adjusted p < 0.05.

Survey data (R attitude)

drawing a supplied matrix

A supplied 7 × 7 correlation matrix of supervisor ratings, drawn in full with the diagonal.

How to make a correlation heatmap

  1. Paste or open a table with one row per observation and one column per variable, or download the raw-data template. Text columns such as IDs are skipped and listed; untick any numeric column you want to leave out.
  2. Choose Pearson or Spearman. Turn on p-values only if you need them: show adjusted p in the table or mark p < 0.05 with an asterisk, adjusted with Holm (default) or Benjamini–Hochberg.
  3. Choose the lower or upper triangle or the full matrix, whether to show the diagonal and print values, and the variable order.
  4. Set journal, width, font, title and panel label. The figure blocks with a message if names or values would not fit, instead of shrinking text below the journal minimum.
  5. Export SVG, PDF, PNG or TIFF, download every pair as CSV and copy the Methods text and base-R script.

Data format

Raw data (one row per observation; blank or NA is missing):

ID   Age  BMI   SBP  Glucose
P01  54   27.1  138  5.9
P02  61   31.4  151  7.2
P03  47   23.8  124

Or a correlation matrix you already have:

         Age   BMI   SBP
Age      1     0.21  0.48
BMI      0.21  1     0.39
SBP      0.48  0.39  1

To show one pair with its scatter and fitted line, use Scatter Plot Maker; to compare distributions between groups, use Box Plot Maker.

Method and numerical checks

r, pairwise n, two-sided p-values (t = r√((n − 2)/(1 − r²)), n − 2 df; Spearman with the t approximation as R cor.test(exact = FALSE)), Fisher-z 95% intervals for Pearson r and Holm or Benjamini–Hochberg adjustment are checked against base R cor, cor.test and p.adjust on mtcars, airquality, iris and edge-case files, to a relative difference of 10⁻⁹. Correlation describes association, not cause.

Frequently asked questions

Should I use Pearson or Spearman correlation?

Pearson r measures linear association and suits roughly symmetric variables without strong outliers. Spearman ρ is the Pearson correlation of ranks: it measures monotonic association and is less affected by skew and outliers. Choose before looking at the results and say which one you used; the Methods text does this for you.

How are missing values handled?

Each pair of variables uses the rows where both values are present (pairwise complete, as R cor with use = "pairwise.complete.obs"). The n of every pair is in the n table and its range is in the reading summary and Methods text. Pairs with fewer than 3 shared values show no r.

Why are the p-values adjusted?

A matrix of k variables tests k(k − 1)/2 pairs at once: 11 variables already give 55 tests, so some unadjusted p-values fall below 0.05 by chance. Holm controls the chance of any false positive; Benjamini–Hochberg controls the expected share of false positives (FDR). p-values are off by default and adjusted with Holm when you turn them on.

Why is the colour scale fixed from −1 to 1 and centred at 0?

A fixed scale keeps colours comparable between figures and stops a weak correlation from looking strong. Zero sits at the light middle, negative and positive correlations get two different hues, and the default brown–teal and orange–purple scales stay distinguishable with common colour-vision deficiencies. The value and its sign are also printed in the cell.

Can I paste a correlation matrix instead of raw data?

Yes. Paste a square table whose first column repeats the header names. The matrix is checked for symmetry, a diagonal of 1 and values between −1 and 1, and drawn as given. Choose “A correlation matrix” under The table holds if it is not recognised automatically.

Why are there no p-values for a supplied matrix?

A p-value for r needs the number of observations behind it, which a matrix does not contain (and with missing data it differs per pair). Compute the matrix here from the raw data to get n and adjusted p-values.

Is my data uploaded?

No. Tables, Excel files and project files are read and computed in your browser; nothing is sent to a server. The R script lets you reproduce every r, n and p in base R.