@@ -2314,7 +2314,9 @@ def _check_layout_engines_compat(self, old, new):
23142314 If the figure has used the old engine and added a colorbar then the
23152315 value of colorbar_gridspec must be the same on the new engine.
23162316 """
2317- if old is None or old .colorbar_gridspec == new .colorbar_gridspec :
2317+ if old is None or new is None :
2318+ return True
2319+ if old .colorbar_gridspec == new .colorbar_gridspec :
23182320 return True
23192321 # colorbar layout different, so check if any colorbars are on the
23202322 # figure...
@@ -2330,10 +2332,13 @@ def set_layout_engine(self, layout=None, **kwargs):
23302332
23312333 Parameters
23322334 ----------
2333- layout : {'constrained', 'tight'} or `~.LayoutEngine`
2335+ layout : {'constrained', 'tight', 'none' } or `~.LayoutEngine`
23342336 'constrained' will use `~.ConstrainedLayoutEngine`, 'tight' will
23352337 use `~.TightLayoutEngine`. Users and libraries can define their
23362338 own layout engines as well.
2339+
2340+ The string 'none' removes layout engine.
2341+
23372342 kwargs : dict
23382343 The keyword arguments are passed to the layout engine to set things
23392344 like padding and margin sizes. Only used if *layout* is a string.
@@ -2350,6 +2355,8 @@ def set_layout_engine(self, layout=None, **kwargs):
23502355 new_layout_engine = TightLayoutEngine (** kwargs )
23512356 elif layout == 'constrained' :
23522357 new_layout_engine = ConstrainedLayoutEngine (** kwargs )
2358+ elif layout == 'none' :
2359+ new_layout_engine = None
23532360 elif isinstance (layout , LayoutEngine ):
23542361 new_layout_engine = layout
23552362 else :
0 commit comments