(self, state)
| 3324 | return state |
| 3325 | |
| 3326 | def __setstate__(self, state): |
| 3327 | version = state.pop('__mpl_version__') |
| 3328 | restore_to_pylab = state.pop('_restore_to_pylab', False) |
| 3329 | |
| 3330 | if version != mpl.__version__: |
| 3331 | _api.warn_external( |
| 3332 | f"This figure was saved with matplotlib version {version} and " |
| 3333 | f"loaded with {mpl.__version__} so may not function correctly." |
| 3334 | ) |
| 3335 | self.__dict__ = state |
| 3336 | |
| 3337 | # re-initialise some of the unstored state information |
| 3338 | self._set_base_canvas() |
| 3339 | # force the bounding boxes to respect current dpi |
| 3340 | self.dpi_scale_trans.clear().scale(self._dpi) |
| 3341 | if restore_to_pylab: |
| 3342 | # lazy import to avoid circularity |
| 3343 | import matplotlib.pyplot as plt |
| 3344 | import matplotlib._pylab_helpers as pylab_helpers |
| 3345 | allnums = plt.get_fignums() |
| 3346 | num = max(allnums) + 1 if allnums else 1 |
| 3347 | backend = plt._get_backend_mod() |
| 3348 | mgr = backend.new_figure_manager_given_figure(num, self) |
| 3349 | pylab_helpers.Gcf._set_new_active_manager(mgr) |
| 3350 | plt.draw_if_interactive() |
| 3351 | |
| 3352 | self.stale = True |
| 3353 | |
| 3354 | def add_axobserver(self, func): |
| 3355 | """Whenever the Axes state change, ``func(self)`` will be called.""" |
nothing calls this directly
no test coverage detected