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

[ENH]: add Figure.align_titles() functionality#22793

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

Closed
aswarner wants to merge14 commits intomatplotlib:mainfromaswarner:vector

Conversation

aswarner
Copy link

PR Summary

Resolves#22376 . AddFigure.align_titles() function, which automatically aligns titles of subplots on a single figure, in the style ofalign_labels().

NOTE: This PR contains tested code but we still need to complete documentation and pytest.

PR Checklist

Tests and Styling

  • Has pytest style unit tests (andpytest passes).
  • IsFlake 8 compliant (installflake8-docstrings and runflake8 --docstring-convention=all).

Documentation

  • New features are documented, with examples if plot related.
  • New features have an entry indoc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented indoc/api/next_api_changes/ (follow instructions in README.rst there).
  • Documentation is sphinx and numpydoc compliant (the docs shouldbuild without error).

@aswarner
Copy link
Author

We are working on documentation/testing and need to squash the commits.

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 while, please feel free to ping@matplotlib/developers or anyone who has commented on the PR. 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.

@QuLogicQuLogic marked this pull request as draftApril 7, 2022 03:28
@oscargusoscargus added topic: ticks axis labels topic: axes status: needs workflow approvalFor PRs from new contributors, from which GitHub blocks workflows by default. and removed topic: axes labelsApr 7, 2022
@oscargusoscargus added this to thev3.6.0 milestoneApr 7, 2022
@@ -1241,6 +1242,60 @@ def align_xlabels(self, axs=None):
# grouper for groups of xlabels to align
self._align_label_groups['x'].join(ax, axc)

def align_titles(self, axs=None):
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we want to addalign_titles toalign_labels? Though this would be a breaking change ofalign_labels.

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.

Overall this looks good! Not set on rolling into_align_label_groups, but might be more compact.

aswarner reacted with heart emoji
@aswarner
Copy link
Author

We aligned the titles by changing the image bounding boxes, which works withplt.show() , but not withsavefig or pytest (the image rendered for a pytest doesn't have aligned titles) due to the differing chain of function calls. Is this an infrastructure issue that has a workaround?

@jklymak
Copy link
Member

I am not on my computer for a few days to look properly what you mean. However the alignment should work the same as for x and y labels. All of them may need a draw before they are correct to get the text sizes correct.

update testfirstcopy a bbox function to axesBase from figureadd broken code? commented outalign titles worksfinish code and add testsadd demoremove readme2
@@ -0,0 +1,26 @@
"""
===============
Aligning Labels
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
AligningLabels
AligningTitles

?

@@ -2950,7 +2950,7 @@ def _update_title_position(self, renderer):
_log.debug('title position was updated manually, not adjusting')
return

titles =(self.title, self._left_title, self._right_title)
titles =[self.title, self._left_title, self._right_title]
Copy link
Member

Choose a reason for hiding this comment

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

Is this required? It doesn't look like you are actually modifyingtitles.

@oscargusoscargus removed the status: needs workflow approvalFor PRs from new contributors, from which GitHub blocks workflows by default. labelAug 19, 2022
@QuLogicQuLogic modified the milestones:v3.6.0,v3.7.0Aug 24, 2022
@@ -2950,7 +2950,7 @@ def _update_title_position(self, renderer):
_log.debug('title position was updated manually, not adjusting')
return

titles =(self.title, self._left_title, self._right_title)
titles =[self.title, self._left_title, self._right_title]
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
titles=[self.title,self._left_title,self._right_title]
titles=(self.title,self._left_title,self._right_title)

@melissawm
Copy link
Member

Hi@aswarner - can we help you move this forward? Thanks!

@QuLogicQuLogic modified the milestones:v3.7.0,v3.8.0Jan 4, 2023
@jklymak
Copy link
Member

ping@aswarner just had another request for this feature today. If you are not moving forward with the PR, should we open up to other folks? Thanks!

rraadd88 reacted with thumbs up emoji

@AlextheGreat1509AlextheGreat1509 mentioned this pull requestMar 31, 2023
2 tasks
@ksundenksunden modified the milestones:v3.8.0,future releasesAug 8, 2023
trananso added a commit to trananso/matplotlib that referenced this pull requestMar 19, 2024
@tranansotrananso mentioned this pull requestMar 20, 2024
5 tasks
trananso added a commit to trananso/matplotlib that referenced this pull requestMar 20, 2024
@rcomer
Copy link
Member

Closing in favour of#27952.

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

@jklymakjklymakjklymak left review comments

@oscargusoscargusoscargus left review comments

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

Assignees
No one assigned
Projects
Status: Waiting for author
Milestone
future releases
Development

Successfully merging this pull request may close these issues.

[ENH]: align_titles
9 participants
@aswarner@jklymak@melissawm@rcomer@oscargus@QuLogic@ksunden@dstansby@bromberc

[8]ページ先頭

©2009-2025 Movatter.jp