From 49e0aef999e6fb66fc16d4fdc21a0ae6d5cff197 Mon Sep 17 00:00:00 2001
From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
Date: Wed, 30 Aug 2023 15:36:23 +0200
Subject: [PATCH] Backport PR #26636: [Doc] Improve set_layout_engine docs

---
 lib/matplotlib/figure.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py
index 4361ef655c81..8f80658f8708 100644
--- a/lib/matplotlib/figure.py
+++ b/lib/matplotlib/figure.py
@@ -2475,7 +2475,7 @@ def __init__(self,
 
             - '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
+              decorations do not overlap. See `.set_tight_layout` for
               further details.
 
             - 'none': Do not use a layout engine.
@@ -2618,8 +2618,7 @@ def set_layout_engine(self, layout=None, **kwargs):
 
         Parameters
         ----------
-        layout: {'constrained', 'compressed', 'tight', 'none'} or \
-`LayoutEngine` or None
+        layout : {'constrained', 'compressed', 'tight', 'none', `.LayoutEngine`, None}
 
             - 'constrained' will use `~.ConstrainedLayoutEngine`
             - 'compressed' will also use `~.ConstrainedLayoutEngine`, but with
@@ -2628,6 +2627,8 @@ def set_layout_engine(self, layout=None, **kwargs):
             - 'tight' uses `~.TightLayoutEngine`
             - 'none' removes layout engine.
 
+            If a `.LayoutEngine` instance, that instance will be used.
+
             If `None`, the behavior is controlled by :rc:`figure.autolayout`
             (which if `True` behaves as if 'tight' was passed) and
             :rc:`figure.constrained_layout.use` (which if `True` behaves as if
@@ -2637,7 +2638,7 @@ def set_layout_engine(self, layout=None, **kwargs):
             Users and libraries can define their own layout engines and pass
             the instance directly as well.
 
-        kwargs: dict
+        **kwargs
             The keyword arguments are passed to the layout engine to set things
             like padding and margin sizes.  Only used if *layout* is a string.