Skip to content

Navigation Menu

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

Appearance settings

fixed #24617 bug - Added subplot params and figsize getter setter methods to Figure.__init__ with tests #29116

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
Loading
from

Conversation

Thanushri16
Copy link

PR summary
This is the first PR I am proposing and this PR fixes #24617 - [ENH]: Add setter/getter methods for all keyword parameters to Figure.init
Few of the arguments passed to Figure.init did not have matching get_{kwarg}/set_{kwarg} methods on Figure (Bug #24617).
This PR focuses on adding getter/setter methods and test coverage for the following:

  • figsize (which wraps around get_size_inches and set_size_inches)
  • subplotparams

What problem does this PR solve?
Two of the properties/parameters of Figure class didn't have getter/setter methods implemented - figsize, subplotparams. Without these getter/setter methods, use of the properties in the Figure class is inconsistent and neither does the class provide a way to set properties for these two attributes without the getter/setter methods.

Relevant PRs (Both of these PRs have failing tests and failing checks for PR reviews):

  1. PR #25901 - This PR focuses on getter/setter methods to resolve Bug [ENH]: Add setter/getter methods for all keyword parameters to Figure.__init__ #24617 . The PR encounters AttributeError: 'Figure' object has no attribute 'get_subplotpars' that is not resolved and also has failing PR checks.
  2. PR #28936 - This PR resolves the AttributeError issues in PR #25901. However, the PR still had some failing test cases in pytest and has some failing PR checks.

PR checklist:

##Review
Since, this is my first contribution in the open source, I would like to know the feedback and tips to improve my contributions.

…n getter setter for subplot param and figsize
Copy link

@github-actions github-actions bot 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 us on gitter for real-time discussion.

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

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

self.set_subplotparams(self.get_subplotparams())
self.subplots_adjust(**kwargs)

def get_subplotparams(self):
Copy link
Member

Choose a reason for hiding this comment

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

This method is not run by the tests because you replaced it in the Figure subclass, so only the subclass one gets run by your new test. I'm not too familiar with subplotparams but, as far as I can see, they only exist on a Figure and not on a SubFigure so both these methods could go directly on the Figure class.

Copy link
Author

Choose a reason for hiding this comment

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

@rcomer Fixed the above inheritance issue. Thanks for pointing it out. I've moved the definitions to Figure and all the pytest cases passed locally. Could you please review my failing pytest macOS tests?

Copy link
Member

Choose a reason for hiding this comment

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

Those MacOS ones are often flakey. I’ve re-started them to see if they do better this time 🤞

Copy link
Member

Choose a reason for hiding this comment

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

For the documentation failure I think you just need to add your new methods to an appropriate section here, to make them show up in the docs:
https://github.com/matplotlib/matplotlib/blob/main/doc/api/figure_api.rst

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Needs review
Development

Successfully merging this pull request may close these issues.

[ENH]: Add setter/getter methods for all keyword parameters to Figure.__init__
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.