Plot guides › How-to

GraphPad Prism-style plot in Python

The familiar Prism column scatter shows every replicate as a dot, a horizontal line at the mean and error bars, on bold, open axes. matplotlib can reproduce it exactly, and you keep the script with the data.

Example graphpad prism-style plot in python 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:

"Prism-style dot plot with mean ± SEM, bold axes, add a significance bracket between Control and Drug A"

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 matplotlib.pyplot as plt

rng = np.random.default_rng(37)
groups = {"Control": rng.normal(10, 1.5, 8), "Drug A": rng.normal(14, 2, 8),
          "Drug B": rng.normal(11, 1.8, 8)}

plt.rcParams.update({"font.family": "sans-serif", "font.weight": "bold",
                     "axes.labelweight": "bold", "axes.linewidth": 1.5})
fig, ax = plt.subplots(figsize=(4, 4))
for i, (name, vals) in enumerate(groups.items()):
    ax.scatter(i + rng.uniform(-0.15, 0.15, vals.size), vals, s=30,
               facecolor="none", edgecolor="k", lw=1.2)
    m, sem = vals.mean(), vals.std(ddof=1) / np.sqrt(vals.size)
    ax.hlines(m, i - 0.25, i + 0.25, color="k", lw=2)
    ax.errorbar(i, m, yerr=sem, color="k", capsize=8, lw=1.5)
# Significance bracket: run your own test and put its result here
top = max(v.max() for v in groups.values()) + 1
ax.plot([0, 0, 1, 1], [top, top + 0.4, top + 0.4, top], color="k", lw=1.2)
ax.text(0.5, top + 0.5, "**", ha="center", fontsize=12)
ax.set_xticks(range(len(groups)), groups.keys())
ax.set_ylabel("Tumour volume (mm³)")
ax.set_xlim(-0.6, len(groups) - 0.4)
ax.spines[["top", "right"]].set_visible(False)
ax.tick_params(width=1.5)
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