Skip to content

DOC: add layout='none' option to Figure constructor #25305

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

Merged
merged 1 commit into from
Feb 24, 2023

Conversation

rcomer
Copy link
Member

@rcomer rcomer commented Feb 23, 2023

PR Summary

Closes #25223. Documents the layout='none' option for creating a figure.

PR Checklist

Documentation and Tests

  • Has pytest style unit tests (and pytest passes)
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • New plotting related features are documented with examples.

Release Notes

  • New features are marked with a .. versionadded:: directive in the docstring and documented in doc/users/next_whats_new/
  • API changes are marked with a .. versionchanged:: directive in the docstring and documented in doc/api/next_api_changes/
  • Release notes conform with instructions in next_whats_new/README.rst or next_api_changes/README.rst

@rcomer rcomer added this to the v3.7.1 milestone Feb 23, 2023
Copy link
Member

@jklymak jklymak left a comment

Choose a reason for hiding this comment

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

This is fine. Note that for pyplot it's not great to refer to the .Figure constructor for the meaning of the layout options.

@rcomer
Copy link
Member Author

rcomer commented Feb 23, 2023

I could copy the full description across to pyplot?

@jklymak
Copy link
Member

jklymak commented Feb 23, 2023

I would, but it could be a different PR.

managers can measurably slow down figure display. Defaults to *None*
(but see the documentation of the `.Figure` constructor regarding the
interaction with rcParams).
managers can measurably slow down figure display. Defaults to *None*.
Copy link
Member

Choose a reason for hiding this comment

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

Probably can remove the Default here as it's in the type line.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

Comment on lines 749 to 770
- 'constrained': The constrained layout solver adjusts axes sizes
to avoid overlapping axes decorations. Can handle complex plot
layouts and colorbars, and is thus recommended.

See :doc:`/tutorials/intermediate/constrainedlayout_guide`
for examples.

- 'compressed': uses the same algorithm as 'constrained', but
removes extra space between fixed-aspect-ratio Axes. Best for
simple grids of axes.

- 'tight': Use the tight layout mechanism. This is a relatively
simple algorithm that adjusts the subplot parameters so that
decorations do not overlap. See `.Figure.set_tight_layout` for
further details.

- 'none': Do not use a layout engine.

- A `.LayoutEngine` instance. Builtin layout classes are
`.ConstrainedLayoutEngine` and `.TightLayoutEngine`, more easily
accessible by 'constrained' and 'tight'. Passing an instance
allows third parties to provide their own layout engine.
Copy link
Member

Choose a reason for hiding this comment

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

There is an extra indent on all the continuation lines of each bullet point.

Copy link
Member Author

Choose a reason for hiding this comment

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

oooops

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

@jklymak
Copy link
Member

jklymak commented Feb 24, 2023

@@ -2420,11 +2420,11 @@ def __init__(self,
The use of this parameter is discouraged. Please use
``layout='constrained'`` instead.

layout : {'constrained', 'compressed', 'tight', `.LayoutEngine`, None}
layout : {'constrained', 'compressed', 'tight', 'none', `.LayoutEngine`, \
None}, default: None
Copy link
Member

Choose a reason for hiding this comment

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

Its not your fault, but the 'constrained' bullet below has an extra indent

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh that's why it's in bold. I was scratching my head about that...

@rcomer
Copy link
Member Author

rcomer commented Feb 24, 2023

I think it's OK now

@jklymak jklymak merged commit 7da6e48 into matplotlib:main Feb 24, 2023
@jklymak
Copy link
Member

jklymak commented Feb 24, 2023

Agreed, thanks for cleaning up the previous breakage!

meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Feb 24, 2023
@rcomer rcomer deleted the layout-options branch February 24, 2023 16:59
rcomer added a commit that referenced this pull request Feb 24, 2023
…305-on-v3.7.x

Backport PR #25305 on branch v3.7.x (DOC: add layout='none' option to Figure constructor)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Doc]: layout="none" for figure constructor?
3 participants