FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[ENH]: Add setter/getter methods for all keyword parameters to Figure.__init__ · Issue #24617 · matplotlib/matplotlib · GitHub

Repository navigation

[ENH]: Add setter/getter methods for all keyword parameters to Figure.__init__ #24617

Open
shaw5lee/matplotlib
#1

Description

Problem

At least 2 of the arguments passed to Figure.__init__ do not have matching get_{kwarg}/set_{kwarg} methods on Figure which makes using fig.set(...) inconsistent with what can be done via Figure(...).

xref #21549 which was motivated by this and includes an implementation of the solution (along with some additional refactoring).

Proposed solution

See #21549 for a majority of the implementation. cherry-picking commits from that branch and dropping the layout management refactoring is a very good start.

  • use alias mechanism for size_inches -> figsize
  • add get/set_subplotparams
  • use alias mechanism from layout -> layout_engine
  • tests!
  • whats new entry

Labeling this as good first issue because it is limited scope and easy because there is an existing implementation. There will be a discussion of API consistency so I think familiarity with Matplotlib's explicit API would be very helpful.

Activity

  1. added
    Difficulty: Easyhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issues
    🌱 Good first issueOpen a pull request against these issues if there are no active ones!
    on Dec 4, 2022
  2. added this to the future releases milestone on Dec 4, 2022
  3. deepgohil commented on Dec 4, 2022

    @tacaswell I would like to take this up. As this will be my first contribution to this repo. if you can guide me it will be very helpful.

  4. tacaswell commented on Dec 4, 2022

    MemberAuthor

    Please see:

    I also strongly suggest you start by cherry-picking the commits from #21549 and use that as a base.

  5. deepgohil commented on Dec 5, 2022

    @tacaswell Will you help on following points

    Can you elaborate more on alias mechanism of layout and size_inches figsize

    And can you specifically mention for which params we have to implement getter and setters
    image

  6. tacaswell commented on Dec 5, 2022

    MemberAuthor

    Can you elaborate more on alias mechanism of layout and size_inches figsize

    See

    @_api.define_aliases({
    "antialiased": ["aa"],
    "color": ["c"],
    "drawstyle": ["ds"],
    "linestyle": ["ls"],
    "linewidth": ["lw"],
    "markeredgecolor": ["mec"],
    "markeredgewidth": ["mew"],
    "markerfacecolor": ["mfc"],
    "markerfacecoloralt": ["mfcalt"],
    "markersize": ["ms"],
    })
    for an example.

    And can you specifically mention for which params we have to implement getter and setters

    I do not know this off the top of my head, part of the work that needs to be done on this issue is to sort out which of the keywords to __init__ are missing matching setter/getter pairs.

  7. Gairick52 commented on Jan 10, 2023

    @tacaswell Hello sir,i want to work on this issue,please assign this to me

  8. tacaswell commented on Jan 10, 2023

    MemberAuthor

    @Gairick52 as noted in other issues, we do not currently assign issues, if you are interested in working on this please do so and open a PR.

  9. vortex73 commented on Jan 13, 2023

    Hi! This is my first contrib and am open to learning any new concepts involved. Could you just elaborate on what you require for the Getters & Setters portion?
    Thanks!

  10. NoyHanan commented on May 5, 2023

    Contributor

    Hi all, is it still open?

  11. tacaswell commented on May 5, 2023

    MemberAuthor

    It looks like the linked PR (#24696) has been marked as orphaned and needs a rebase. I think taking over that PR is fair game as we have not heard from the original author in a few months.

  12. 8 remaining items

  13. timhoffm commented on Apr 2, 2024

    Member

    @shalul The issue is open, so not solved yet. But as linked above, it has an associated open pull request, i.e. a solution proposal. Therefore it does not make sense to work on this issue. Please look for another topic if you want to contribute.

    As a side question, we often see people who ask in the way you did above coming from a CS course? Is that true for you as well? If so, which course and did they give you instructions on how to find suitable issues, in particular identifying whether an issue has already an associated open pull request and to judge whether that pull request is still active?

  14. priscillajordan commented on Jun 26, 2024

    Hey @timhoffm, I see no one answered your question about users coming from CS courses. I am currently taking CEN3031 - Introduction to Software Engineering. It is the first class I've ever taken that has included an assignment relating to open source software contributions. The assignment description asks students to find an open source software, look for an issue labeled "good first issue", and contribute to it. We are told to specifically contribute with code or a bug fix. Nowhere in the assignment description does it mention pull requests, or determining if an issue is still active. The only tips provided relate to choosing a project with an active community with good first issues labeled. After reading this thread, it seems like people may be submitting PR's just for the sake of it (possibly related to assignment requirements for a class), or maybe just not understanding when a solution is in progress. It seems to make more work for the developers approving PRs, so it may help to add a note about this in the various resources for first time contributors. Hope this helps!

  15. added a commit that references this issue on Oct 3, 2024
  16. Thanushri16 commented on Nov 8, 2024

    Is the issue 24617 closed?

  17. added a commit that references this issue on Nov 10, 2024
    b1e887a
  18. timhoffm commented on Feb 17, 2025

    Member

    @tacaswell Sorry for being late in the process, but we need to clarify the API strategy. Fundamentally,

    1. It's desireable to have naming consistency between kwargs and setters
    2. We should try not to have multiple ways of doing the same thing (shortcut aliases are a permissible exception because they are an intentional tradoff beween clarity and brevity for typing)

    We cannot have both without API breakage, so it needs to be a conscious decision for every single case, which depends on boudary conditions like breadth of use and suitability of the name(s). Also we need to consider wether we can/want to move the API through discouraging/(pending) deprecating.

    Let's move the individual discussions to

  19. removed
    🌱 Good first issueOpen a pull request against these issues if there are no active ones!
    Difficulty: Easyhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issues
    on Feb 17, 2025
  20. timhoffm commented on Feb 17, 2025

    Member

    I'm removing the tags "good first issue" and "difficulty: easy" for now. While they are correct for the eventual implementation, we need a though API discussion and decission first. These tags have lead to multiple PRs that just add the new methods but I'm not convinced at all that just adding more API is the right solution. We can add the tags back when we are clear on the API.

  21. timhoffm commented on Feb 17, 2025

    Member

    Semi-OT: Process-wise we are doing something wrong here. The issue has now 10 PRs trying to address it. This is quite unreasonable and a waste of ressources. I'm not sure what's going wrong, probably it's a combination of factors (i) "Good first issue" attracting contributions, (ii) a too broad / imprecise specification (some issues only address parts), (iii) contributors not delivering to the spec or not responding (iv) our inability to review timely, (v) my general caution on the topic (#24617 (comment)), which led me to ignore the topic for long and hope that somebody else will take the neccessary decisions.

    How can we recover and how can we prevent this in the future?

  22. melissawm commented on Mar 27, 2026

    Member

    We discussed this issue in the weekly project meeting yesterday, and the general opinion is that this issue needs refinement before it's actually actionable.

    For this reason, I will close all related open issues for now. This does not mean authors can't open another PR in the future or that the proposed solution is necessarily innapropriate, but this will help us focus our efforts.

    Thanks!

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL