Plot guides › By field

Plot a 96-well plate as a heatmap

Drawing plate reader values in the physical 8 × 12 layout of a 96-well plate makes edge effects, gradients and mis-pipetted wells visible immediately, before you average anything.

Example plot a 96-well plate as a heatmap made with matplotlib
Rendered from the code below, with example data.

When to use it

Ask for it in pltchat

Upload your file and type something like:

"show the plate as an 8x12 heatmap with well values written in each cell"

pltchat writes the loader and the plot for your columns, runs it in your browser and shows you the code.

The matplotlib code

Self-contained with example data; swap in pd.read_csv(...) or pd.read_excel(...) for your own file.

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

rng = np.random.default_rng(35)
rows, cols = list("ABCDEFGH"), list(range(1, 13))
df = pd.DataFrame([{"well": f"{r}{c}", "value": 1.0 + rng.normal(0, 0.04)
                    - 0.15 * (r in "AH" or c in (1, 12))}
                   for r in rows for c in cols])
df.loc[df["well"] == "D7", "value"] = 0.45            # a pipetting error

df["row"] = df["well"].str[0]
df["col"] = df["well"].str[1:].astype(int)
plate = df.pivot(index="row", columns="col", values="value")

fig, ax = plt.subplots(figsize=(7, 4))
im = ax.imshow(plate, cmap="magma")
ax.set_xticks(range(12), cols)
ax.set_yticks(range(8), rows)
ax.xaxis.tick_top()
for i in range(8):
    for j in range(12):
        v = plate.iat[i, j]
        ax.text(j, i, f"{v:.2f}", ha="center", va="center", fontsize=6.5,
                color="w" if v < 0.85 else "k")
fig.colorbar(im, ax=ax, label="Signal (a.u.)", shrink=0.8)
plt.tight_layout()
plt.show()

Make this with your data

Upload a CSV, Excel, JSON or Parquet file. Your first plot is always free.

Related plots