Skip to content

Fix axisartist label font sizes set through Axes - #32384

Open
baba9811 wants to merge 2 commits into
matplotlib:mainfrom
baba9811:fix/axisartist-label-fontsize
Open

baba9811 wants to merge 2 commits into
matplotlib:mainfrom
baba9811:fix/axisartist-label-fontsize

Conversation

@baba9811

Copy link
Copy Markdown

PR summary

Fixes #28124.

Make axisartist axis labels follow the font size set through set_xlabel and set_ylabel. Direct font settings on individual axisartist labels still take precedence. Font lookup caches store snapshots so inherited font properties do not retain closed figures.

Regression tests compare rendered figures and cover explicit overrides, mutable font properties, copying, bounding boxes, and figure lifetime. The previous attempt in #31155 is closed and unmerged.

Testing

  • Axisartist, axes_grid1, Text, and font-manager suites: 276 passed, 52 skipped. Skips require Ghostscript, Inkscape, TeX, unavailable fonts, or another operating system.
  • The new PNG comparisons failed before the fix and pass afterward. The original public-API reproduction now renders the requested 20pt labels on both axes.
  • Additional SVG output comparison and PDF raster comparison with Poppler both match the explicit-label workaround.
  • Changed-file prek checks, including mypy, Ruff, and codespell, pass.
  • The full repository suite and cross-platform CI have not been run locally.

AI Disclosure

Used Codex for implementation and testing.

@github-actions

Copy link
Copy Markdown

Thank you for opening your first PR into Matplotlib!

If you have not heard from us in a week or so, please leave a new comment below and that should bring it to our attention. Most of our reviewers are volunteers and sometimes things fall through the cracks. We also ask that you please finish addressing any review comments on this PR and wait for it to be merged (or closed) before opening a new one, as it can be a valuable learning experience to go through the review process.

You can also join us on discourse chat for real-time discussion.

For details on testing, writing docs, and our review process, please see the developer guide.
Please let us know if (and how) you use AI, it will help us give you better feedback on your PR.

We strive to be a welcoming and open project. Please follow our Code of Conduct.

@baba9811
baba9811 marked this pull request as ready for review September 23, 2026 16:33
@rcomer

rcomer commented Sep 24, 2026

Copy link
Copy Markdown
Member

Hi @baba9811

Used Codex for implementation and testing.

This reads like the contribution is fully AI generated. Please review our AI Policy and confirm whether there is a human author who has thought through the problem and can discuss the change with us.

@baba9811

Copy link
Copy Markdown
Author

@rcomer
Hi, I directed the investigation, reviewed the changes, and can discuss the implementation. I used Codex for implementation and testing. My original disclosure didn’t clearly explain my involvement.

The issue is that axisartist draws a separate label whose font size wasn’t following set_xlabel / set_ylabel. The fix makes it inherit that size while preserving explicit settings on the axisartist label. The font-cache change stores a snapshot to avoid retaining closed figures

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: can not set ylabel fontsize in host_subplot

3 participants