Skip to content
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

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

Open
tacaswell opened this issue Dec 4, 2022 · 15 comments · Fixed by shaw5lee/matplotlib#1 · May be fixed by #27257, #27997 or #27531
Open

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

tacaswell opened this issue Dec 4, 2022 · 15 comments · Fixed by shaw5lee/matplotlib#1 · May be fixed by #27257, #27997 or #27531
Labels
Difficulty: Easy https://matplotlib.org/devdocs/devel/contribute.html#good-first-issues Good first issue Open a pull request against these issues if there are no active ones! New feature

Comments

@tacaswell
Copy link
Member

tacaswell commented Dec 4, 2022

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.

@tacaswell tacaswell added New feature Difficulty: Easy https://matplotlib.org/devdocs/devel/contribute.html#good-first-issues Good first issue Open a pull request against these issues if there are no active ones! labels Dec 4, 2022
@tacaswell tacaswell added this to the future releases milestone Dec 4, 2022
@deepgohil
Copy link

@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.

@tacaswell
Copy link
Member Author

Please see:

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

@deepgohil
Copy link

deepgohil commented 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

image

@tacaswell
Copy link
Member Author

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.

@Gairick52
Copy link

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

@tacaswell
Copy link
Member Author

@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.

@vortex73
Copy link

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!

@NoyHanan
Copy link
Contributor

NoyHanan commented May 5, 2023

Hi all, is it still open?

@tacaswell
Copy link
Member Author

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.

@Lambxx
Copy link

Lambxx commented Nov 2, 2023

I have seen there are a few PR's on this, but none have closed the issue. Am I ok to add a PR?
If so does it require tests to be added?
thanks

@tacaswell
Copy link
Member Author

@Lambxx We have not heard from any of the other contributors for 3 weeks, so I think it would be OK if you wanted to pick this up.

This requires tests and a whats new entry.

It looks like #25901 is most of the way there, I suggest cherry-picking those commits and working from there.

@Lambxx
Copy link

Lambxx commented Nov 2, 2023

I have added a PR; apologies in advance if anything is broken/missing I am new to this so any feedback would be great. Thanks

jasonavatarang added a commit to jasonavatarang/matplotlib that referenced this issue Feb 8, 2024
jasonavatarang added a commit to jasonavatarang/matplotlib that referenced this issue Feb 8, 2024
@shalul
Copy link

shalul commented Apr 1, 2024

Hi! Is this issue still open? If so I would love to know how to contribute!

@QuLogic
Copy link
Member

QuLogic commented Apr 1, 2024

It is, but there also appear to be a couple open PRs as linked above.

@timhoffm
Copy link
Member

timhoffm commented Apr 2, 2024

@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?

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