Skip to content

Examples: round-inch layouts, PNG/SVG/PDF output, GraphPadPrism style throughout - #8

Merged
FridrichMethod merged 2 commits into
mainfrom
docs/examples-round-inch-layout
Nov 17, 2026
Merged

FridrichMethod merged 2 commits into
mainfrom
docs/examples-round-inch-layout

Conversation

@FridrichMethod

Copy link
Copy Markdown
Owner

Summary

Regenerates every README image for the new GraphPadPrism style (#7) and sets rendering conventions.

  • examples/_common.py (new) holds the shared setup:
    • require_arial(): the scripts exit when Arial is not installed instead of writing images in a fallback font.
    • add_axes, legend, suptitle: place axes (position and axis lengths), legend corners and figure titles in inches.
    • save(): writes examples/<name>.png (600 dpi), .svg and .pdf, uncropped (savefig.bbox: standard), without SVG/PDF timestamps and with a fixed SVG id salt, so rerunning an unchanged script reproduces all files byte for byte.
  • Layouts in round inches. Figure sizes, axes positions and sizes, and legend/title anchors are multiples of 0.1, 0.25, 0.5 or 1 in. Saved PNGs are exactly figure size × 600 px (e.g. 3 × 2.25 in → 1800 × 1350 px). Demos pass no fontsize/fontweight, so all text is the style's Arial Regular 8 pt.
  • palettes_demo.py uses the GraphPadPrism style, as styles_demo.py does. Only default_style (the Matplotlib-defaults comparison) is unstyled. Legends of multi-series plots sit outside the axes; scatter marker size is reduced (s=40 → s=10) for the smaller panels.
  • All 14 figures in three formats (42 files; ~2.4 MB PNG, ~0.6 MB SVG, ~0.3 MB PDF).
  • README shows the images at 100 px per inch (the top comparison stays at 400 px each), so 8 pt text looks the same size everywhere; the gallery pairs are regrouped by width, and the regeneration notes describe the layout and formats.
  • AGENTS.md gains a "Rendering Figures" section with these conventions.

Test plan

  • PNG sizes equal figure size × 600 dpi for all 14 figures.
  • Two consecutive runs of both scripts give byte-identical PNG, SVG and PDF files (42/42).
  • Every Prism PDF embeds only a TrueType ArialMT subset (no Type 3); no SVG contains <text>.
  • Visual check of every figure: no clipped text, no legend overlapping data.
  • pre-commit run --all-files (ruff, mypy now also type-check examples/)
  • pytest (286 passed)

…hroughout

- examples/_common.py holds the shared setup: the Arial check, add_axes,
  legend and suptitle helpers that place axes, legends and figure titles in
  inches, and save(), which writes PNG (600 dpi), SVG and PDF uncropped and
  without timestamps, so unchanged scripts reproduce the files byte for byte.
- Every README figure except the Matplotlib-defaults comparison uses the
  GraphPadPrism style, including the palette demos. Figure sizes, axes
  positions and lengths, and legend anchors are round inches; demos pass no
  fontsize or fontweight.
- All images are regenerated in the three formats.
- README shows the images at 100 px per inch and documents the layout and
  formats; AGENTS.md records the rendering conventions.
Copilot AI balanced review requested due to automatic review settings November 17, 2026 01:35

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@FridrichMethod
FridrichMethod merged commit 151b9ee into main Nov 17, 2026
3 checks passed
@FridrichMethod
FridrichMethod deleted the docs/examples-round-inch-layout branch November 17, 2026 01:38
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.

2 participants