Skip to content

[Doc]: layout="none" for figure constructor? #25223

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

Closed
rcomer opened this issue Feb 15, 2023 · 4 comments · Fixed by #25305
Closed

[Doc]: layout="none" for figure constructor? #25223

rcomer opened this issue Feb 15, 2023 · 4 comments · Fixed by #25305
Milestone

Comments

@rcomer
Copy link
Member

rcomer commented Feb 15, 2023

Documentation Link

https://matplotlib.org/devdocs/api/_as_gen/matplotlib.pyplot.figure.html

Problem

Suppose you have constrained layout turned on in general via rcParams, but want to not use it for a particular figure. This seems to work

import matplotlib.pyplot as plt

plt.rcParams["figure.constrained_layout.use"] = True
fig = plt.figure(layout="none")
print(fig.get_layout_engine())
None

but layout="none" is not documented as a valid option in either pyplot.figure or the Figure constructor.

Suggested improvement

Should layout="none" be documented as a valid option?

@timhoffm
Copy link
Member

Yes! 👍

@RishabhSpark
Copy link
Contributor

I will like to work on this, can you guide me to the file please, I am new to opensource

@rcomer
Copy link
Member Author

rcomer commented Feb 16, 2023

Thanks @RishabhSpark, the relevant docstrings are here for pyplot.figure and here for the Figure constructor. For bonus points, you could also add the layout="compressed" option to the pyplot.figure docstring, as that is also missing.

rcomer pushed a commit that referenced this issue Feb 19, 2023
* layout none and compressed added in pyplot

* Update lib/matplotlib/pyplot.py

Co-authored-by: Jody Klymak <jklymak@gmail.com>

* compressed added

* fixed (89>88) error ig(?)

---------

Co-authored-by: Jody Klymak <jklymak@gmail.com>
oscargus added a commit that referenced this issue Feb 20, 2023
…234-on-v3.7.x

Backport PR #25234 on branch v3.7.x (added layout="compressed" for pyplot #25223)
robrighter pushed a commit to robrighter/matplotlib that referenced this issue Feb 20, 2023
* layout none and compressed added in pyplot

* Update lib/matplotlib/pyplot.py

Co-authored-by: Jody Klymak <jklymak@gmail.com>

* compressed added

* fixed (89>88) error ig(?)

---------

Co-authored-by: Jody Klymak <jklymak@gmail.com>
@QuLogic
Copy link
Member

QuLogic commented Feb 21, 2023

It appears you've added 'compressed', but not 'none' as well?

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

Successfully merging a pull request may close this issue.

4 participants