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

[MRG] Constrained_layout (geometry manager) by jklymak · Pull Request #9082 · matplotlib/matplotlib · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .pdf  (1) .png  (17) .py  (15) .rst  (2) .svg  (1) .template  (1) All 6 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
API changes for ``constrained_layout``
----------------------------------------

The new constrained_layout functionality has some minor (largely backwards-
compatible) API changes. See
:ref:`sphx_glr_tutorials_intermediate_constrainedlayout_guide.py` for
more details on this functionality.

This requires a new dependency on kiwisolver_.

_https://github.com/nucleic/kiwi

kwarg ``fig`` deprectated in `.GridSpec.get_subplot_params`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Use ``figure`` instead of ``fig``, which is now deprecated.
59 changes: 59 additions & 0 deletions doc/users/next_whats_new/constrained_layout.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
Constrained Layout Manager
---------------------------

.. warning::

Constrained Layout is **experimental**. The
behaviour and API are subject to change, or the whole functionality
may be removed without a deprecation period.


A new method to automatically decide spacing between subplots and their
organizing ``GridSpec`` instances has been added. It is meant to
replace the venerable ``tight_layout`` method. It is invoked via
a new ``constrained_layout=True`` kwarg to
`~.figure.Figure` or `~.figure.subplots`.

There are new ``rcParams`` for this package, and spacing can be
more finely tuned with the new `~.set_constrained_layout_pads`.

Features include:

- Automatic spacing for subplots with a fixed-size padding in inches around
subplots and all their decorators, and space between as a fraction
of subplot size between subplots.
- Spacing for `~.figure.suptitle`, and colorbars that are attached to
more than one axes.
- Nested `~.GridSpec` layouts using `~.GridSpecFromSubplotSpec`.

For more details and capabilities please see the new tutorial:
:doc:`/tutorials/intermediate/constrainedlayout_guide`

Note the new API to access this:

New ``plt.figure`` and ``plt.subplots`` kwarg: ``constrained_layout``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:meth:`~matplotlib.pyplot.figure` and :meth:`~matplotlib.pyplot.subplots`
can now be called with ``constrained_layout=True`` kwarg to enable
constrained_layout.

New ``ax.set_position`` behaviour
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:meth:`~matplotlib.axes.set_position` now makes the specified axis no
longer responsive to ``constrained_layout``, consistent with the idea that the
user wants to place an axis manually.

Internally, this means that old ``ax.set_position`` calls *inside* the library
are changed to private ``ax._set_position`` calls so that
``constrained_layout`` will still work with these axes.

New ``figure`` kwarg for ``GridSpec``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In order to facilitate ``constrained_layout``, ``GridSpec`` now accepts a
``figure`` keyword. This is backwards compatible, in that not supplying this
will simply cause ``constrained_layout`` to not operate on the subplots
orgainzed by this ``GridSpec`` instance. Routines that use ``GridSpec`` (e.g.
``fig.subplots``) have been modified to pass the figure to ``GridSpec``.
Loading

Back | FazBrowse Home | New Git URL