Skip to content

Tier 3: hatching, colorbar orientation, fills, margins, mathtext and 3D extras - #10

Merged
certik merged 7 commits into
polish1from
tier3
Aug 16, 2026
Merged

certik merged 7 commits into
polish1from
tier3

Conversation

@certik

@certik certik commented Aug 16, 2026

Copy link
Copy Markdown
Member

Stacked on #9 (branch polish1); merge that first.

Six commits, one per item of the Tier 3 list:

  • Fills — fill_betweenx, stackplot and axline. fill_betweenx is the same series as fill_between with a horiz flag, so it keeps the legend swatch, colour cycle, alpha and where= for free; axline takes no part in the limits and is clipped to the axes rectangle in pixels.
  • Margins — axes_t%tight is gone, replaced by xmargin/ymargin, with margins() and autoscale() on top. axis("tight") is now "set the margins to zero".
  • Colorbar — orientation, fraction, pad, shrink and aspect, with the geometry measured off matplotlib rather than guessed; the old fixed width fraction was only right at the default figure size.
  • Hatching — matplotlib's 72 pt tile, ruled in canvas coordinates and cut to the polygon, on bars, fills, polygons and rectangles. Nothing was added to the backend API for it.
  • Mathtext — \frac, \sqrt and the greek letters. Fractions and roots need strokes, so a run may now be a line as well as a piece of text. Greek meant making text UTF-8: SVG emits a character reference, PNG has the DejaVu greek outlines, and PDF/EPS fill those outlines since no core font carries greek.
  • 3D — plot_wireframe, and plot_surface(cmap=).

Cases 91-96 in tests/test_plots.f90 with matching matplotlib references. All five harnesses pass: SVG structure, PNG (mean 1.60/255), PDF, EPS and GIF.

certik added 7 commits August 16, 2026 09:04
fill_betweenx is the same band as fill_between with the axes read the
other way round, so it is the same series with a flag rather than a kind
of its own. stackplot is nothing but a run of bands, each starting where
the last one stopped. axline is the one that needs its own drawing: it
has no extent, so it takes no part in the limits and is clipped to the
axes rectangle in pixels.
The axes carried a tight flag, which was only ever the question of
whether the five percent margin was applied. A margin per axis says the
same thing and says more, so tight becomes a margin of nothing and
margins() sets whatever else is wanted. autoscale() then pins the limits
where the data has put them, which is the only way to stop an axis from
growing with what is drawn next.
The bar was three tuned constants, one of which was a width fraction
that only came out right at the default figure size; matplotlib gets the
same number from an aspect ratio, so a bar in a narrow subplot was too
thin. Taking matplotlib's four numbers instead - fraction, pad, shrink
and aspect - gives the horizontal bar for free, since the only
difference is which way the slices and the ticks run.
Matplotlib hatches by tiling a pattern behind the shape and clipping it
to the path; the backend API here clips to rectangles only, on purpose,
so the lines are cut to the shape where they are made instead. A ruled
line crosses the outline an even number of times, so the crossings sort
into pairs and each pair is one dash, which works for any polygon and
asks nothing of the four backends.
@certik
certik merged commit 23e0c44 into polish1 Aug 16, 2026
1 check passed
@certik
certik deleted the tier3 branch August 16, 2026 19:11
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