Skip to content

Fix title font property precedence#31877

Open
samiat4911 wants to merge 2 commits into
matplotlib:mainfrom
samiat4911:fix-title-font-kwargs-order
Open

Fix title font property precedence#31877
samiat4911 wants to merge 2 commits into
matplotlib:mainfrom
samiat4911:fix-title-font-kwargs-order

Conversation

@samiat4911

@samiat4911 samiat4911 commented Jun 12, 2026

Copy link
Copy Markdown

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

@rcomer

rcomer commented Jun 12, 2026

Copy link
Copy Markdown
Member

Is this only a problem for title or does it affect other text objects? From #27608 (comment) I would have expected the fix to be deeper.

@samiat4911

Copy link
Copy Markdown
Author

@rcomer thanks for the feedback please have a look at the update I just did.
if there's anything you are not satisfied let me know thanks :)

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]: Font kwargs for pyplot.title only work in certain order

2 participants