Menu

Tutorial9 min read

PCA Biplot in Python: How to Make and Interpret Scores and Loadings

By Francesco VillasmuntaUpdated March 21, 2026
PCA Biplot in Python: How to Make and Interpret Scores and Loadings

A PCA biplot is one of the fastest ways to understand a multivariate dataset. It shows sample separation and variable direction in the same figure, which makes it useful for metabolomics, spectroscopy, materials data, and any workflow where interpretation matters as much as compression.

What a biplot actually shows

Scores

Each point is a sample projected into principal component space.

Loadings

Each arrow shows which variables drive the separation on PC1 and PC2.

Interpretation

Points that cluster together behave similarly in the original feature space.

Minimal PCA biplot code

The important part is not just running PCA. You need to standardize features, scale the loading vectors sensibly, and label axes with explained variance.

Try it

Try it now: create a PCA biplot from your dataset

Run PCA, visualize scores and loadings, and export a figure ready for publication.

Generate my PCA biplot

Newsletter

Get a weekly Python plotting tip

One concise tip each week for cleaner, faster scientific figures. Built for researchers who publish.

No spam. Unsubscribe anytime.
import numpy as np
import matplotlib.pyplot as plt
from sklearn.decomposition import PCA
from sklearn.preprocessing import StandardScaler

rng = np.random.default_rng(7)
X = rng.normal(size=(60, 5))
X[:, 0] += np.linspace(-2, 2, 60)
X[:, 1] += X[:, 0] * 0.7

X_scaled = StandardScaler().fit_transform(X)
pca = PCA(n_components=2)
scores = pca.fit_transform(X_scaled)
loadings = pca.components_.T

fig, ax = plt.subplots(figsize=(7, 6))
ax.scatter(scores[:, 0], scores[:, 1], alpha=0.75)

for i, (lx, ly) in enumerate(loadings):
    ax.arrow(0, 0, lx * 2.5, ly * 2.5, head_width=0.08, color="crimson")
    ax.text(lx * 2.7, ly * 2.7, f"V{i+1}", color="crimson")

ax.axhline(0, color="gray", lw=0.8)
ax.axvline(0, color="gray", lw=0.8)
ax.set_xlabel(f"PC1 ({pca.explained_variance_ratio_[0]:.1%})")
ax.set_ylabel(f"PC2 ({pca.explained_variance_ratio_[1]:.1%})")
ax.set_title("PCA Biplot")
plt.tight_layout()

Common mistakes

  • Skipping standardization when variables use different units.
  • Using too many loadings arrows so the figure becomes unreadable.
  • Forcing interpretation from weak PCs that explain very little variance.
  • Not explaining whether the arrows represent correlations or raw loadings.

Use this when

You need a compact figure for exploratory analysis, omics interpretation, or a manuscript that compares samples across hidden multivariate structure.

Skip it when

A simple correlation matrix or pair plot tells the story more clearly than a dense biplot with dozens of variables.

Want to compare PCA with other statistical figures? Start with the PCA technique page, then review the common visualization mistakes guide.

Try Plotivy with your data
Tags:#PCA#biplot#multivariate analysis#python#matplotlib

Found this helpful? Share it with your network.

FV
Francesco Villasmunta

Experimental Physicist & Photonics Researcher

Hands-on experience in silicon photonics, semiconductor fabrication (DRIE/ICP-RIE), optical simulation, and data-driven analysis. Built Plotivy to help researchers focus on discoveries instead of data struggles.

More about the author

Visualize your own data

Apply the techniques from this article to your own datasets. Upload CSV, Excel, or paste data directly.

Start Analyzing - Free