Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Suptitle swapping order of updates between defaults and fontdict#27707

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
lcapalleja wants to merge2 commits intomatplotlib:main
base:main
Choose a base branch
Loading
fromlcapalleja:suptitle_fontdict_size_bug

Conversation

lcapalleja
Copy link

Closes#27630

PR summary

Issue#27630 highlighted how passing asize value insidefontdict was being ignored withinfigure.suptitle. This was happening because the default kwargs sent to Text were being updated with the defaults last (i.e. highest priority). Switching the order of the dictionary update fixes this, giving highest priority to arguments specified infontdict by the user.

Test code by@boffi:

import matplotlib.pyplot as pltfig = plt.figure(figsize=(8, 3), layout='constrained')f0, f1 = fig.subfigures(1, 2)f0.suptitle('xxxXXX', fontdict=dict(family='Candara', size=30))f0.add_subplot().set_title('xxxXXX', fontdict=dict(family='Candara', size=20))f1.suptitle('xxxXXX', size=30, fontdict=dict(family='Candara'))f1.add_subplot().set_title('xxxXXX', size=20, fontdict=dict(family='Candara'))plt.show()

Broken behavior:
Figure_0

Fixed behavior:
Figure_1

PR checklist

Note: This is my first PR. Please let me know if I messed up anything here.

Copy link

@github-actionsgithub-actionsbot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

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.

You can also join uson gitter for real-time discussion.

For details on testing, writing docs, and our review process, please seethe developer guide

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

Copy link
Member

@jklymakjklymak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Can you add a test to our test suite to make sure this works and continues to work? Probably inlib/matplotlib/tests//test_figure.py.

@lcapalleja
Copy link
Author

@jklymak, I added a test. Let me know if this needs anything else.

@jklymak
Copy link
Member

Is it possible to test without an image test by querying the fontsize? We try to minimize image tests, particularly with text, but sometimes it is unavoidable.

@lcapallejalcapallejaforce-pushed thesuptitle_fontdict_size_bug branch from4a78e56 tocd17206CompareFebruary 6, 2024 18:17
@lcapalleja
Copy link
Author

Is it possible to test without an image test by querying the fontsize? We try to minimize image tests, particularly with text, but sometimes it is unavoidable.

@jklymak, made this change. Thank you for the guidance!

@QuLogic
Copy link
Member

The new test does not appear to be passing.

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

@jklymakjklymakjklymak left review comments

@github-actionsgithub-actions[bot]github-actions[bot] left review comments

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Projects
Status: Needs review
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

[Bug]: Inconsistency in fig.suptitle treatment of size=...
4 participants
@lcapalleja@jklymak@QuLogic@rcomer

[8]ページ先頭

©2009-2025 Movatter.jp