Gallery¶
python examples/gallery.py builds these twenty-four figures and audits each
one.
The script exits non-zero if any figure fails, so they are regression tests with
pictures attached rather than decoration.
They exist because demo.py, one panel and three curves, is easy for a gate to
pass, so passing it says little about the gate.
These are the compositions where a check has somewhere to hide. Writing them
exposed defects of two kinds: in the checks themselves, and in figures no check
flagged. Both are listed at the end of this page, except the six rows the
callout and secondary-axis figures exposed, which
the 0.9.0 changelog lists.
Every alt text here is the string the figure itself carries, passed to
describe(fig, ...) before the audit runs, so the alt-text gate reads it.
Shared scales¶
A filled field¶
No axes at all¶
ax.axis("off"). A figure with no data and no visible tick labels is the case most gates were not written against.Three statistical forms¶
Log-log, with a slope triangle¶
Density as the finding¶
Three encodings¶
A band around each curve¶
venue="neurips", placed_frac=0.75 measures the type and stroke floors at the 0.90x it prints at.Counts, and a second unit for them¶
check_dual_axis exists to permit: secondary_yaxis derives its ticks from the left scale, so the two cannot drift apart the way a twinx with hand-set limits silently can.A signed field¶
contour.negative_linestyle defaults to dashed, so a monochrome contour over signed data ships its negative half dashed with nobody having chosen it, and dashing here means unobserved, projected, or a threshold.Marks, then bins¶
A callout that points¶
Two scales for one quantity¶
fig.axes, so ticks the locator placed outside its own view were read as clipped text rather than as ghosts.A survival curve¶
ax.step keeps the points it was handed and draws risers between them, so the drawstyle has to be expanded before any geometry is harvested; read raw, the label and banking rows measure the diagonal chord of each riser instead of the two segments drawn.A spike raster¶
eventplot draws an EventCollection, which reports one linewidth where every other collection reports a sequence. The line-weight gate called list() on it and raised TypeError, which _rows turns into a hard fail: a legal figure failing on a defect in the checker.A direction, on the projection it belongs on¶
Predicted against observed¶
Boundaries named along themselves¶
A field with its own significance¶
float() raises on one. The contrast-stack row reads the array rather than the scalar for exactly this figure, counting a ramp across one artist as a single alpha decision; counted per cell it reports sixteen levels of haze and fails a figure that made one choice.An inset that carries its own data¶
ax.inset_axes and the corpus had no figure with one carrying data, so the sweep that shipped the fix had nothing it could move. This is that figure. The inset holds four curves of its own, they are sampled off an ordered ramp rather than taken from the categorical cycle, and the two panels are stacked on one x scale: the three things measured at two, two and one panel of twenty when the fixes went in.Curves crossing under a legend¶
One legend for three panels¶
A pair hue alone cannot carry¶
A reference line across a series¶
axvline draws in a blended transform, and read through transData the line would sit at data y 0 to 1, below this panel.Why figures eight to eleven exist¶
The first seven figures were audited against every gate, and the detail strings
showed which rows had never measured anything. Five had not. No figure drew a
confidence band, a bar, a diverging colormap, a signed contour set, or a
scatter, so those rows returned a passing detail seven times over without once
running the code that decides.
A row that passes by having seen nothing looks exactly like a row that passed. That is the blind spot how the checkers decide names, and this page had been an example of it.
Why figures fourteen to nineteen exist¶
The same question, asked mechanically rather than by eye. Run under coverage,
the thirteen figures above never reached a rotated label's oriented box, a
LineCollection's widths, a step drawstyle, a polar axes, a per-point alpha
array, or the equal-radii path in the overplotting gate: 281 statements of
check_figure.py that no figure here could speak for.
Each of the six is a form a reader would recognise before it is a branch. A
figure drawn to reach a line of code is not
evidence about anything. They took the 281 down to 239, and two of them found
defects in the checker on the way in. main also audits the sheet's own
palette with check_palette, which no figure exercises: that took the second
module from 74% to 82% on the same measurement.
Why figures twenty-one to twenty-four exist¶
The series-colour row decides which pairs to compare before it compares any, and the corpus barely reached that decision. Before these four, 12 of the 16 panels that gate two or more hues compared one pair, orange against sky blue. No figure had a figure legend, a coloured reference line or a pair that a second channel had to carry, and the sheet's last three hues were never drawn.
Each of the four reaches one of those. Against the commit before the invariance round, two verdicts move: the red-green pair fails without its second channel, and the rule-change line is read at data y 0 to 1. The two legend figures, whose legends gate a pair draw order skipped, move only their Series color detail. Against the one before its code-review fixes, one verdict moves.
The nine defects in the checks¶
- The readability gate reported a schematic's invisible tick labels.
check_inkcalled every colorbar a saturated panel.- The line-weight gate measured a colorbar's own dividers as hairline strokes.
- A path and its start marker in one hue read as a wrapped color cycle.
- Testing a label's backdrop against its dominant color failed every annotation ever placed on a heatmap.
check_label_attributionpassed labels in the right margin that sat 29px from their own curve and 35px from a neighbour's. A label outside the data is not resolved by proximity to anything._enclosestested a band's outline through the affine part of the transform only, so on a log axis a confidence band stopped being its own curve's band and became its rival.check_line_weightraised TypeError on anEventCollection, which reports one linewidth where every other collection reports a sequence.check_label_attributioncounted a curve's own censoring ticks as a rival series. A companion mark drawn along its curve, in its curve's colour, sits 0px away by construction, so no placement of the label could clear it.
The four defects no check caught¶
- The schematic's feedback arrow ran off the bottom of the canvas.
- The convergence plot's slope triangle sat in the only corner its direct labels could use.
- The survival curves stopped at the last event, leaving their tail censoring ticks floating with no line beneath them.
- The regime diagram's boundary labels were rotated by the slope in the data rather than the slope on the page. On log axes those are different numbers, and both strings came out flat beside a rising curve.
All four were obvious in the PNG and invisible to every check. They are why the procedure has a step that says to render the figure and look at it.
The self-test, and the demo¶
python skill/scripts/check_figure.py with no arguments builds a deliberately
broken figure and audits it, so the self-test shows the gates can fail rather
than only that they can pass. The demo below is the figure that passes.
python examples/demo.py, with every decision commented against the failure it avoids.