Fix title font property precedence by samiat4911 · Pull Request #31877 · matplotlib/matplotlib
PR summary
Explicit title font properties now take precedence over complete font or fontproperties values regardless of keyword argument order.
Previously, these calls produced different font sizes:
ax.set_title("Title", font="DejaVu Sans", fontsize=20) ax.set_title("Title", fontsize=20, font="DejaVu Sans")
Axes.set_title() now applies complete font properties first, followed by individual properties such as fontsize. Regression tests cover both keyword orders using font-family strings and FontProperties objects.
closes #27608
AI Disclosure
OpenAI Codex was used to analyze the issue, implement the fix and add regression tests. The changes were reviewed and validated with the available local checks.
PR checklist
- "closes #0000" is in the body of the PR description to link the related issue
- new and changed code is tested
- Plotting related features are demonstrated in an example
- [N/A] New Features and API Changes are noted with a directive and release note
- [N?A ] Documentation complies with general and docstring guidelines