StatFas.com

How to Make a Correlogram in StatFas, SPSS, R, Python and Excel

By StatFas · Updated 2026-11-09

This tutorial draws the same correlogram, hiding non-significant cells after Holm adjustment, in five tools. The example table has ten numeric columns and no group column: il6, tnf, crp, glucose, insulin, hba1c, bmi, waist, fat_pct and age.

Open the free Correlogram GeneratorRead the full guide

What you will make

A publication-ready correlogram with the compulsory checks and statistics that go with it, produced in five ways. The StatFas generator needs no coding and no account to run; the code versions are for readers who want a scripted workflow. For the theory behind the plot and how to read it, see the full guide.

Example data

ColumnContents
il6, tnf, crpInflammation markers
glucose, insulin, hba1cGlycaemic measures
bmi, waist, fat_pctBody composition
ageAge in years

Save your table as correlogram.csv with a header row. The StatFas generator has a Load Example Data button with simulated data, so you can follow along without your own file. The example data are invented for illustration and are not real findings.

Method 1: StatFas (free, no coding)

  1. Open the Correlogram Generator and click Load Example Data, or paste/upload your own file.
  2. Choose the coefficient and the p-value adjustment (Holm is a good default). Set Variable order to clustered to group related variables, and choose how non-significant cells are shown.
  3. Run the analysis. Read the correlation matrix, 95% confidence intervals, adjusted p-values, descriptive statistics and distribution check.
  4. Change the colors for negative and positive correlations, fonts, sizes and triangle display styles in the figure controls.
  5. Log in (free) to download the figure, tables and Word file, including the APA7 correlation table.
Analysis needs no login. Downloads of figures, tables and Word reports need a free StatFas account.

Method 2: SPSS

SPSS gives the correlation table but not a correlogram. In the menus: Analyze > Correlate > Bivariate, select the variables, tick Pearson, Spearman or Kendall’s tau-b, and keep Flag significant correlations. Syntax:

CORRELATIONS
  /VARIABLES=il6 tnf crp glucose insulin hba1c bmi waist fat_pct age
  /PRINT=TWOTAIL NOSIG
  /MISSING=PAIRWISE.

NONPAR CORR
  /VARIABLES=il6 tnf crp glucose insulin hba1c bmi waist fat_pct age
  /PRINT=SPEARMAN TWOTAIL NOSIG
  /MISSING=PAIRWISE.

SPSS does not adjust for multiple tests and draws no matrix plot. Copy the matrix into Excel for a colour scale, or use StatFas, R or Python.

Method 3: R

library(Hmisc); library(corrplot)
df <- read.csv("correlogram.csv")

rc <- rcorr(as.matrix(df), type = "pearson")        # or "spearman"
p_adj <- matrix(0, ncol(df), ncol(df), dimnames = dimnames(rc$P))
p_adj[lower.tri(p_adj)] <- p.adjust(rc$P[lower.tri(rc$P)], method = "holm")
p_adj[upper.tri(p_adj)] <- t(p_adj)[upper.tri(p_adj)]

corrplot(rc$r, method = "circle", type = "lower", order = "hclust",
         p.mat = p_adj, sig.level = 0.05, insig = "blank", tl.col = "black")

Packages: install.packages(c("Hmisc","corrplot")). Use method = "square" or "number" for other displays.

Method 4: Python

import numpy as np, pandas as pd, seaborn as sns, matplotlib.pyplot as plt
from scipy import stats

df = pd.read_csv("correlogram.csv"); cols = df.columns; k = len(cols)
r = df.corr(method="pearson")                    # use "spearman" or "kendall" for skewed data
pm = pd.DataFrame(np.ones((k, k)), index=cols, columns=cols); pairs = []
for i in range(k):
    for j in range(i + 1, k):
        pairs.append((i, j, stats.pearsonr(df.iloc[:, i], df.iloc[:, j])[1]))
p = np.array([q[2] for q in pairs]); order = p.argsort(); m = len(p); adj = np.empty(m); run = 0
for rank, idx in enumerate(order):                # Holm adjustment
    run = max(run, min(1, (m - rank) * p[idx])); adj[idx] = run
for (i, j, _), a in zip(pairs, adj): pm.iloc[i, j] = pm.iloc[j, i] = a

mask = np.triu(np.ones((k, k), bool)) | (pm.values >= 0.05)   # hide upper triangle and non-significant cells
ax = sns.heatmap(r, mask=mask, cmap="RdBu_r", vmin=-1, vmax=1, annot=True, fmt=".2f", square=True, cbar_kws={"label": "Pearson r"})
plt.tight_layout(); plt.savefig("correlogram.png", dpi=300)
print(r.round(2)); print("Pairs significant after Holm:", int((adj < 0.05).sum()), "of", m)

Requires numpy, pandas, scipy, seaborn and matplotlib. Use method="spearman" in df.corr and stats.spearmanr for rank correlations.

Method 5: MATLAB, OriginPro, Excel and others

Excel

Compute the matrix with Data > Data Analysis > Correlation (enable the Analysis ToolPak), then select the matrix and apply Home > Conditional Formatting > Color Scales with blue–white–red. Excel gives no p-values or adjustment.

MATLAB

T = readtable("correlogram.csv");
[R, P] = corrcoef(T{:,:});
heatmap(T.Properties.VariableNames, T.Properties.VariableNames, R, "Colormap", redbluecmap);

Which method should you choose?

ToolCost and skillPlotStatistical checksReport-ready output
StatFasFree, in the browserYes (circles, squares, numbers)Pearson/Spearman/Kendall, CIs, Holm/FDRYes, APA7 table in Word
SPSSLicence neededNoCoefficients and p-values, no adjustmentTables only
RFree, codingYes (corrplot)Hmisc, p.adjustManual
PythonFree, codingYes (seaborn)scipy, manual adjustmentManual

Choose StatFas for speed and APA7-ready output, SPSS if your department already licenses it and you only need the statistics, and R or Python when the analysis must be scripted and reproduced in a pipeline.

How to report the result in APA7

Present a table with correlations, means and standard deviations, and a note stating the coefficient, the correction and the significance level. In the text, report r(df), 95% CI and the adjusted p for key pairs. StatFas writes the APA7 table and paragraph for you.

See the guide for an example paragraph.

Troubleshooting

Frequently asked questions

Can SPSS make a correlogram?

Not directly. SPSS provides the correlation table; use Excel conditional formatting, R, Python or StatFas for the plot.

How many variables can a correlogram handle?

Up to about 30 stay readable. Beyond that, order by clustering or show only the strongest correlations.

Try it now. Run the analysis in your browser with the free Correlogram Generator. No account is needed to analyze; a free StatFas account is needed only to download figures, tables and the Word report.

Related tools, guides and tutorials

References

  1. American Psychological Association. (2020). Publication manual of the American Psychological Association (7th ed.).
  2. Benjamini, Y., & Hochberg, Y. (1995). Controlling the false discovery rate: A practical and powerful approach to multiple testing. Journal of the Royal Statistical Society B, 57(1), 289–300.
  3. Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd ed.). Lawrence Erlbaum Associates.
  4. Friendly, M. (2002). Corrgrams: Exploratory displays for correlation matrices. The American Statistician, 56(4), 316–324.
  5. Holm, S. (1979). A simple sequentially rejective multiple test procedure. Scandinavian Journal of Statistics, 6(2), 65–70.