@@ -2314,7 +2314,9 @@ def _check_layout_engines_compat(self, old, new):
2314
2314
If the figure has used the old engine and added a colorbar then the
2315
2315
value of colorbar_gridspec must be the same on the new engine.
2316
2316
"""
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 :
2318
2320
return True
2319
2321
# colorbar layout different, so check if any colorbars are on the
2320
2322
# figure...
@@ -2330,10 +2332,13 @@ def set_layout_engine(self, layout=None, **kwargs):
2330
2332
2331
2333
Parameters
2332
2334
----------
2333
- layout : {'constrained', 'tight'} or `~.LayoutEngine`
2335
+ layout : {'constrained', 'tight', 'none' } or `~.LayoutEngine`
2334
2336
'constrained' will use `~.ConstrainedLayoutEngine`, 'tight' will
2335
2337
use `~.TightLayoutEngine`. Users and libraries can define their
2336
2338
own layout engines as well.
2339
+
2340
+ The string 'none' removes layout engine.
2341
+
2337
2342
kwargs : dict
2338
2343
The keyword arguments are passed to the layout engine to set things
2339
2344
like padding and margin sizes. Only used if *layout* is a string.
@@ -2350,6 +2355,8 @@ def set_layout_engine(self, layout=None, **kwargs):
2350
2355
new_layout_engine = TightLayoutEngine (** kwargs )
2351
2356
elif layout == 'constrained' :
2352
2357
new_layout_engine = ConstrainedLayoutEngine (** kwargs )
2358
+ elif layout == 'none' :
2359
+ new_layout_engine = None
2353
2360
elif isinstance (layout , LayoutEngine ):
2354
2361
new_layout_engine = layout
2355
2362
else :
0 commit comments