@@ -2313,7 +2313,9 @@ def _check_layout_engines_compat(self, old, new):
23132313 If the figure has used the old engine and added a colorbar then the
23142314 value of colorbar_gridspec must be the same on the new engine.
23152315 """
2316- if old is None or old .colorbar_gridspec == new .colorbar_gridspec :
2316+ if old is None or new is None :
2317+ return True
2318+ if old .colorbar_gridspec == new .colorbar_gridspec :
23172319 return True
23182320 # colorbar layout different, so check if any colorbars are on the
23192321 # figure...
@@ -2329,10 +2331,12 @@ def set_layout_engine(self, layout=None, **kwargs):
23292331
23302332 Parameters
23312333 ----------
2332- layout: {'constrained', 'tight'} or `~.LayoutEngine`
2334+ layout: {'constrained', 'tight', 'none' } or `~.LayoutEngine`
23332335 'constrained' will use `~.ConstrainedLayoutEngine`, 'tight' will
23342336 use `~.TightLayoutEngine`. Users and libraries can define their
23352337 own layout engines as well.
2338+
2339+ The string 'none' removes layout engine.
23362340 kwargs: dict
23372341 The keyword arguments are passed to the layout engine to set things
23382342 like padding and margin sizes. Only used if *layout* is a string.
@@ -2349,6 +2353,8 @@ def set_layout_engine(self, layout=None, **kwargs):
23492353 new_layout_engine = TightLayoutEngine (** kwargs )
23502354 elif layout == 'constrained' :
23512355 new_layout_engine = ConstrainedLayoutEngine (** kwargs )
2356+ elif layout == 'none' :
2357+ new_layout_engine = None
23522358 elif isinstance (layout , LayoutEngine ):
23532359 new_layout_engine = layout
23542360 else :
0 commit comments