Plot a standard curve (calibration curve)
A standard curve plots the signal of known standards against their concentration and fits a line (or a 4PL for ELISA). Unknown samples are then read off the fit, ideally plotted on the curve to show they fall within the calibrated range.
When to use it
- Protein assays (BCA, Bradford), ELISA, HPLC or any calibration series.
- You need concentrations of unknowns and a figure for the methods section.
Watch out: Don't extrapolate: unknowns outside the range of the standards should be diluted and re-measured.
Ask for it in pltchat
Upload your file and type something like:
"standard curve with linear fit and R², then plot the unknowns on the line"
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(33)
conc = np.repeat([0, 125, 250, 500, 750, 1000, 1500, 2000], 2) # µg/mL BSA
absorb = 0.1 + 0.00052 * conc + rng.normal(0, 0.02, conc.size)
unknown_abs = np.array([0.42, 0.66, 0.91])
slope, intercept = np.polyfit(conc, absorb, 1)
r2 = np.corrcoef(conc, absorb)[0, 1] ** 2
unknown_conc = (unknown_abs - intercept) / slope
fig, ax = plt.subplots(figsize=(6.4, 4))
ax.scatter(conc, absorb, color="k", s=18, label="Standards")
xs = np.linspace(0, 2000, 100)
ax.plot(xs, slope * xs + intercept, color="C0",
label=f"y = {slope:.2e}x + {intercept:.3f}, R² = {r2:.3f}")
ax.scatter(unknown_conc, unknown_abs, marker="D", color="C1", s=40, zorder=3,
label="Unknowns")
for c, a in zip(unknown_conc, unknown_abs):
ax.annotate(f"{c:.0f}", (c, a), xytext=(5, -12), textcoords="offset points",
color="C1", fontsize=8)
ax.set_xlabel("Protein (µg/mL)")
ax.set_ylabel("Absorbance at 562 nm")
ax.legend(fontsize=8)
plt.tight_layout()
plt.show()
Upload a CSV, Excel, JSON or Parquet file. Your first plot is always free.