GeezerVison is showing github.com — Move contour labeling methods into ContourSet by sahilmathur254 · Pull Request #32579 · matplotlib/matplotlib
Conversation
PR summary
ContourLabeler provides labelling functionality solely for ContourSet, yet the separate mixin complicates documentation and relies on attributes defined by ContourSet. This PR consolidates the methods and type annotations within ContourSet and removes the mixin directly, following the maintainer’s guidance. Documentation and API removal notes are updated, with focused tests and before-and-after comparisons supporting preservation of existing labelling behaviour.
Direct removal follows the maintainer’s confirmation.
Closes #31793.
AI Disclosure
Codex assisted with the code changes, regression coverage, and validation in isolated Docker environments. The PR description was also drafted with AI assistance, and this PR was submitted by Codex with the contributor’s explicit authorisation.
Local validation
- Contour and triangulation test modules: 161 passed, 4 skipped, both before and after the refactor. The skips were two PDF comparisons requiring Ghostscript and two SVG comparisons requiring Inkscape.
- A local comparison across 24 labelling cases produced identical rendered pixels, label text, positions, rotations, and contour paths before and after the change. This covered direct, regular-grid, and triangular contours, automatic/manual placement, inline labels, and
use_clabeltext.
- Ruff and the repository-configured codespell check passed on the changed files.
- Mypy passed for all 108 source files in an environment using the CI build and typing dependency groups. The focused contour runtime/stub comparison also passed.
- A focused Sphinx build of the contour API page,
Axes.clabel, and the removal note passed with warnings treated as errors. Links to unrelated guide pages were outside this focused check; the updated labeling links and method anchors were verified.
- Four broken references in historical API notes were reproduced with a nitpicky Sphinx build and corrected to code literals; the same build then passed without warnings.
The full test suite and full documentation site were not run locally. GitHub CI results are available in the PR checks.
PR quality check
- Use an expressive title, e.g. "Fix title font property precedence"
- New and changed code is tested
- [N/A] Plotting related features are demonstrated in an example — this consolidates existing labeling functionality.
- New features and API changes have release notes
- Documentation complies with general and docstring guidelines
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This branch has not been deployed
No deployments
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.