Skip to content

Make xy.pyplot gallery-compatible with Matplotlib 3.11 - #413

Draft
Alek99 wants to merge 12 commits into
mainfrom
agent/pyplot-gallery-compat
Draft

Make xy.pyplot gallery-compatible with Matplotlib 3.11#413
Alek99 wants to merge 12 commits into
mainfrom
agent/pyplot-gallery-compat

Conversation

@Alek99

@Alek99 Alek99 commented Jul 31, 2026

Copy link
Copy Markdown
Member

Summary

Makes xy.pyplot a gallery-compatible drop-in surface for Matplotlib 3.11 while preserving the dependency-free, performance-oriented native renderer.

  • Adds native, compat, and lazy auto modes plus plt.set_mode(), plt.get_mode(), and XY_PYPLOT_MODE.
  • Adds the public module://xy.backends.backend_xy Matplotlib backend.
  • Uses genuine Matplotlib Figure/Axes/Artist semantics in compat mode and an XY display-list renderer for browser, SVG, and raster output.
  • Covers paths, clipping, collections, images, text/mathtext, hatches, path effects, meshes, Gouraud triangles, toolkits, units, 3-D, widgets, events, and animations.
  • Adds a live browser canvas with pointer/keyboard/scroll/resize/close events, navigation, picking, timers, widgets, and deterministic animation tests.
  • Vendors and hashes the supplied Matplotlib gallery as a permanent executable compatibility contract.

Matplotlib supplies frontend semantics in compat mode, but accepted charts are rendered by XY: gallery acceptance rejects Agg or any other renderer fallback.

Final gallery acceptance

Measure Result
Supplied sources represented 507/507
pyplot-eligible sources accepted 485/485
Standard profile 472/472
Extended profile 13/13
Non-pyplot backend/font/GUI examples classified 22/22
Figure/capture parity 485/485
Dimension policy 485/485
Exact dimensions 481/485
Semantic gate 485/485
Tolerant visual gate 485/485
Browser/interaction behavior 76/76
Fallbacks / waivers / ratchet failures 0 / 0 / 0

Exact pixels are not required. The four non-exact dimensions (skewt, figure_size_units, horizontal_barchart_distribution, and colormap_reference) pass the documented tolerant dimension policy. All other structural, semantic, visual, and behavioral gates pass without waivers.

Exact-head CI and artifact audit

  • Audited head: 99ee677ad05a506b9a4dd11385c708d411b6f43e
  • CI: all green in run 30669491110, including all eight standard gallery shards, the Matplotlib reference job, the 13/13 extended profile, the full Rust/Python/JS suite, Python 3.11, source and wheel packaging, and browser conformance.
  • Binder, Docs, and CodSpeed are also green.
  • Every gallery report records the exact clean head and CPython 3.12.3, including every per-engine result.
  • Cross-version source-provenance and acceptance validation also passes under CPython 3.14.

Standard profile

All eight uploaded artifacts were downloaded and independently audited. Their 472 unique example paths exactly equal the standard manifest; all 944 Matplotlib/XY engine runs completed. Execution, capture, dimensions, semantics, and visuals are 472/472; behavior is 71/71; exact dimensions are 468/472; and fallback, waiver, ratchet, comparison, failure-artifact, and JUnit counts are all zero.

Shard Artifact ZIP SHA-256
0 8808280300 7bec905ba69b99e0cfb79808006b2884fa142c466fa66d8a60b1079306718aa3
1 8808277759 68d5ec461e1b12be193e178b764032e526eecfce431236607129b8e81dcd0092
2 8808275136 b03a321b23923c59173dc090a2c00dacddf2f2a6701ab07c0bd1cffb3ff9a459
3 8808267036 de6885e8e8a921dc3059f0cff4784e2c8c4267ab37a237ab9424b644252a94e4
4 8808267872 4ebb39c595b7aff17201d120c88007232388b69f42233e8b1c835a272f1e4e34
5 8808274261 abbe59245588ca5ec010c21d96c832f5eb5e71e1e04dc53fe93d7c8e4deeca4a
6 8808279720 81f3c2b3a36fd7482fc9bc307f74193a0b7d2913cbaf9adc56149d799faf6f7b
7 8808274829 1568c97a5d2dcbdbd0d94b835356adb0510eb638043fa55d009814a5d12e393c

Extended profile

  • Artifact: 8808274446
  • ZIP SHA-256: a85c5c585c7a26958740c6af8caacfd4f730a161c98171b992ebfbbd75574d4a
  • report.json SHA-256: 2bb1d2d01705410d8589b504693d0b30fd7161c026ad7a65b4b4bd90b550880f
  • junit.xml SHA-256: 5975336704887173dd9128f81f1d9d0dafb8aa64630ef24efbb981c830b3946b
  • Result: 13/13 execution, capture, dimensions, semantics, and visuals; 5/5 behavior; zero fallback, waiver, ratchet, performance-warning, or JUnit failures.

Executable contract and CI

The harness:

  • Records both supplied archive hashes and all 507 source hashes.
  • Proves notebook code-cell AST equivalence without vendoring duplicate notebooks.
  • Rewrites only the pyplot binding using exact token-span edits, with stable hashes across supported Python micro versions.
  • Executes transformed sources as real temporary files.
  • Records interpreter, source, manifest, implementation, figure, capture, dimension, semantic, visual, behavior, warning, performance, and fallback provenance.
  • Rejects stale cross-interpreter resume data, any renderer fallback, any waiver, or a passing-case regression.
  • Runs the standard profile in eight CI shards and provisions TeX, fonts, GTK, Xvfb, optional dependencies, clean argv, and multiprocessing support for the extended profile.

The browser probes use a bounded Playwright/Chromium driver, fail closed when CI requires a browser, preserve semantic diagnostics, and avoid Linux Chromium first-profile hangs.

Evidence and tracked root causes

Browse the permanent comparison screenshots.

Example Matplotlib xy.pyplot
Mesh normalization Matplotlib mesh XY mesh
3-D surface Matplotlib 3-D XY 3-D

Root-cause issues include complete upstream Matplotlib sources, comparison screenshots, affected-example counts, acceptance tests, and the pyplot label:

Fixes #354
Fixes #409
Fixes #414
Fixes #415
Fixes #416

Revalidates #410 and #411.

Review in cubic

@greptile-apps

greptile-apps Bot commented Jul 31, 2026

Copy link
Copy Markdown

Too many files changed for review. (601 files found, 100 file limit)

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b048abfc-2c62-457b-9a16-8d675cc6f4c2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

@codspeed-hq

codspeed-hq Bot commented Jul 31, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 109 untouched benchmarks
⏩ 2 skipped benchmarks1


Comparing agent/pyplot-gallery-compat (99ee677) with main (a2f2976)

Open in CodSpeed

Footnotes

  1. 2 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Alek99 commented Jul 31, 2026

Copy link
Copy Markdown
Member Author

Final exact-head acceptance audit is complete for 99ee677ad05a506b9a4dd11385c708d411b6f43e.

  • CI run 30669491110 is fully green, including all eight standard gallery shards, the 13/13 extended profile, the Matplotlib reference job, full Rust/Python/JS and Python 3.11 suites, browser conformance, sdists, and Windows/Linux wheels. Binder, Docs, and CodSpeed are green too.
  • 507/507 supplied sources are represented: 485/485 pyplot-eligible examples accepted (472 standard + 13 extended), with the remaining 22/22 explicitly classified.
  • Figure/capture, dimension-policy, semantic, and tolerant-visual gates are 485/485; 481/485 dimensions are exact.
  • Interaction behavior is 76/76.
  • Fallbacks, waivers, ratchet failures, comparison failures, and JUnit failures are all zero.
  • Every exact-head report records clean commit provenance and CPython 3.12.3 at both report and engine levels; source/provenance validation also passes cross-version under CPython 3.14.
  • The independently downloaded extended artifact 8808274446 has ZIP SHA-256 a85c5c585c7a26958740c6af8caacfd4f730a161c98171b992ebfbbd75574d4a and report SHA-256 2bb1d2d01705410d8589b504693d0b30fd7161c026ad7a65b4b4bd90b550880f.

The PR description now contains the complete standard shard artifact IDs/digests and final acceptance evidence. The PR remains draft for maintainer review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment