diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py index 8bd42a9cba98..ce8e71f54a53 100644 --- a/lib/matplotlib/figure.py +++ b/lib/matplotlib/figure.py @@ -2108,8 +2108,10 @@ def __getstate__(self): # The canvas cannot currently be pickled, but this has the benefit # of meaning that a figure can be detached from one canvas, and # re-attached to another. - for attr_to_pop in ('canvas', '_cachedRenderer'): - state.pop(attr_to_pop, None) + state.pop("canvas") + + # Set cached renderer to None -- it can't be pickled. + state["_cachedRenderer"] = None # add version information to the state state['__mpl_version__'] = _mpl_version
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: