Multi-panel figure with A, B, C labels
A multi-panel figure puts related plots into one figure, labelled A, B, C, so a paper's argument fits on one page. subplot_mosaic lets panels span rows and columns.
When to use it
- A paper or thesis figure that combines different chart types.
- Panels need different sizes, e.g. one wide panel on top.
Ask for it in pltchat
Upload your file and type something like:
"figure with a wide time course on top and two small panels below, labeled A-C"
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(25)
fig, axd = plt.subplot_mosaic([["A", "A"], ["B", "C"]], figsize=(6.4, 5),
layout="constrained")
t = np.linspace(0, 10, 200)
axd["A"].plot(t, np.sin(t) + rng.normal(0, 0.1, t.size))
axd["A"].set_xlabel("Time (s)")
axd["B"].hist(rng.normal(0, 1, 500), bins=30)
axd["B"].set_xlabel("Value")
axd["C"].scatter(rng.normal(0, 1, 80), rng.normal(0, 1, 80), s=10)
axd["C"].set_xlabel("x")
for label, ax in axd.items():
ax.text(-0.12, 1.05, label, transform=ax.transAxes,
fontsize=13, weight="bold", va="bottom")
plt.show()
Upload a CSV, Excel, JSON or Parquet file. Your first plot is always free.