Skip to content

docs: refresh the panel-assembly section for the two layout engines - #106

Open
Starlitnightly wants to merge 1 commit into
mainfrom
docs/multipanel-section-refresh
Open

docs: refresh the panel-assembly section for the two layout engines#106
Starlitnightly wants to merge 1 commit into
mainfrom
docs/multipanel-section-refresh

Conversation

@Starlitnightly

Copy link
Copy Markdown
Collaborator

Why

Section 8 (## 8. Assemble the panels) predated panel_size=, ov.pl.panelflow, and the helpers that make a plot behave as a panel. Its closing note had become factually wrong — it told readers that ov.pl.multipanel

does not express "panel A is exactly 70 x 70 mm regardless of its neighbours" — if you need that, build the panel with ov.pl.figure and place it with fig.add_axes

Both engines express exactly that now (omicverse#930, omicverse#932).

What the section now covers

The two engines, and when each applies

you fix it derives
multipanel(width=) the canvas the panels
multipanel(panel_size=) the panels the canvas
panelflow every panel's finished size the canvas, by packing

plus panelflow's below= stacking, units='pt', and reserve='tight'/'axis'.

Making a plot behave as a panelroc(aspect='auto') (a fixed square aspect makes matplotlib shrink the axes inside the rectangle the layout assigned, so the panel stops filling its cell and its x-axis leaves the row baseline), boxplot(show_points=False), the volcano threshold guides and its ns: legend key, add_stat_annotation.

Text at panel scaledeclutter_ticks (rotate → stagger → slide apart with leader lines → thin; font sizes never change) and adjust_text (clamped inside the axes, which is what makes it safe to call after a layout resized the panel).

A marsilea heatmap as one panel via rect=, and why rendering it to a raster is not the alternative — it loses the vector text that made the export editable.

sankey and slopeplot(group=) — two panel types a grid of scatter plots cannot express.

Verification

Every code cell in the section was executed against the merged library before committing, using a synthetic AnnData stand-in for pbmc8k: 15 of 15 run clean. (One pre-existing cell needs a realistic gene count for pd.qcut deciles to be unique — it passes at 2000 genes, and pbmc8k has ~33k.)

Companion to omicverse#930 – omicverse#940.

Section 8 predated `panel_size=`, `ov.pl.panelflow`, and the helpers that make
a plot behave as a panel, and its closing note was by then factually wrong: it
told readers `ov.pl.multipanel` "does not express 'panel A is exactly 70 x 70 mm
regardless of its neighbours'" and to fall back to `fig.add_axes`. Both engines
express exactly that now.

Rewritten to cover:

- the two engines and when each applies — canvas-fixed vs panel-fixed
  `multipanel`, and `panelflow` for panels of genuinely different sizes that
  wrap into rows (`below=` stacking, `units='pt'`, `reserve=`)
- making a plot behave as a panel: `roc(aspect='auto')` (a fixed square aspect
  shrinks the axes inside the rectangle a layout assigned),
  `boxplot(show_points=False)`, the volcano threshold guides and its ns legend
  key, and `add_stat_annotation`
- text at panel scale: `declutter_ticks` (rotate, stagger, slide apart with
  leader lines, thin — never resize) and `adjust_text` (clamped inside the axes,
  which is what makes it safe to call after a layout resized the panel)
- a marsilea heatmap as one panel via `rect=`, and why raster-and-imshow is not
  the alternative
- `sankey` and `slopeplot(group=)`

Every code cell was executed against the merged library before committing
(synthetic AnnData stand-in for pbmc8k): 15 of 15 run clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant