8000 Don't pickle Axes' cached renderer. · QuLogic/matplotlib@7fe52ac · GitHub
[go: up one dir, main page]

Skip to content

Commit 7fe52ac

Browse files
committed
Don't pickle Axes' cached renderer.
It's not allowed to be pickled on a Figure, so presumably it shouldn't be allowed on the Axes either. Fixes matplotlib#6870. Fixes matplotlib#6181. Fixes matplotlib#3899.
1 parent eab5814 commit 7fe52ac

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,13 @@ def __init__(self, fig, rect,
582582
right=rcParams['ytick.right'] and rcParams['ytick.major.right'],
583583
which='major')
584584

585+
def __getstate__(self):
586+
# The renderer should be re-created by the figure, and then cached at
587+
# that point.
588+
state = super(_AxesBase, self).__getstate__()
589+
state['_cachedRenderer'] = None
590+
return state
591+
585592
def __setstate__(self, state):
586593
self.__dict__ = state
587594
# put the _remove_method back on all artists contained within the axes

0 commit comments

Comments
 (0)
0