plotpress Logo

Getting started

  • Installation
  • Usage
  • Performance

User guide

  • Plotting methods
  • Configuring axes
  • Figures and layout
  • Styling and colors
  • Saving and showing
  • Viewing figures
  • Interactive figures
  • Coordinate and pixel accuracy
  • How it works

Examples

  • Example gallery
  • Pairwise data
  • Statistical distributions
  • Gridded data
  • Multi-axes layout and annotation
  • Animation
  • Axes & figure manipulation
  • Secondary and inset axes
  • Building a figure across processes
  • Custom interactive JS
  • Seaborn-style distribution plots
  • Limitations
  • Figure layout
  • Grouping axes
    • Grouping axes
      • Grouping related axes
      • Grouping a large grid of panels
      • Highlighting one panel in a grid
      • Side-by-side groups with left/right titles
      • Many small groups: pairing every other row
      • Many small groups: pairing adjacent columns
      • All four title positions at once
      • Group title fontsize, alongside a colorbar
      • Colorbars stay inside the group box
      • Nested groups
      • Unequal padding on each side of a group
      • Many groups sharing one outer edge share one margin
      • 500 panels, 250 groups, each with its own colorbar
      • Irregular group shapes (deleted axes)
      • A dashboard mixing group shapes and deleted axes
      • Mosaic titles, planning a layout ahead, and an ordinary grid’s own lookup
      • Finding a group or axes again: title, id, or position
      • Two ways to build the same grouped figure
      • A group’s own shared x/y labels
      • Reclaiming whitespace after removing axes and groups
  • Large-scale figures

Live plotting

  • Live streaming
  • Acquisition patterns
  • Lab instrument examples

Real applications

  • Real applications

Reference

  • API reference

Limitations

  • Limitations
plotpress
  • Figure layout
  • Grouping axes
  • Grouping related axes
  • Edit on GitHub

Note

Go to the end to download the full example code.

Grouping related axes

fig.group() draws a labeled box around a set of axes – useful for calling out which panels of a larger grid belong together, without having to lay them out as a separate sub-figure. The box is the tight bounding rectangle of the given axes’ own positions, plus a little padding; the title sits just outside whichever edge title_position names.

Six panels here split into two unrelated instrument runs – a temperature sweep (top row) and a pressure sweep (bottom row) – each grouped and labeled so that relationship reads at a glance instead of needing a caption.

The two groups sit right on top of each other, sharing the grid’s one interior row boundary – neither box’s title touches that shared edge, so tight_layout() never reserves any margin there on its own. Without group_spacing(), each box’s own padding would land exactly on that boundary and the two dashed lines would sit flush against each other, reading as one box, not two – call it whenever two groups face each other across an interior boundary like this, not just when they visibly collide.

plot 01 row pairs

Live figure — pick a tool, then zoom, pan, point-pick or annotate. Nothing is active until a tool is selected.

View this figure’s Vega export ↗ — the raw JSON spec, rendered live by a real Vega engine.

View this figure’s Vega-Lite export ↗ — the raw JSON spec(s), rendered live by a real Vega-Lite engine.

import numpy as np
import plotpress

rng = np.random.default_rng(0)
t = np.linspace(0, 10, 200)

fig, axes = plotpress.subplots(2, 3, figsize=(10, 6))

for col, ax in enumerate(axes[0]):
    ax.plot(t, np.sin(t + col) + 0.05 * rng.standard_normal(t.size), color="#d62728")
    ax.set_title(f"Trial {col + 1}")
    ax.set_ylabel("temp (C)" if col == 0 else "")

for col, ax in enumerate(axes[1]):
    ax.plot(t, np.cos(t + col) + 0.05 * rng.standard_normal(t.size), color="#1f77b4")
    ax.set_title(f"Trial {col + 1}")
    ax.set_xlabel("time (s)")
    ax.set_ylabel("pressure (kPa)" if col == 0 else "")

fig.group("Temperature sweep", list(axes[0]), color="#d62728", title_position="top")
fig.group("Pressure sweep", list(axes[1]), color="#1f77b4", title_position="bottom")
fig.group_spacing(hspace=40)
fig.tight_layout()

Total running time of the script: (0 minutes 0.187 seconds)

Download Jupyter notebook: plot_01_row_pairs.ipynb

Download Python source code: plot_01_row_pairs.py

Download zipped: plot_01_row_pairs.zip

Gallery generated by Sphinx-Gallery

Previous Next

© Copyright 2026, plotpress contributors.

Built with Sphinx using a theme provided by Read the Docs.