File tree 2 files changed +11
-0
lines changed 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,13 @@ def remove(self):
32
32
if self ._remove_method :
33
33
self ._remove_method (self )
34
34
35
+ def __getstate__ (self ):
36
+ d = self .__dict__ .copy ()
37
+ # remove the unpicklable remove method, this will get re-added on load
38
+ # (by the axes) if the artist lives on an axes.
39
+ d ['_remove_method' ] = None
40
+ return d
41
+
35
42
def get_label (self ):
36
43
"""
37
44
Get the label used for this artist in the legend.
Original file line number Diff line number Diff line change @@ -114,6 +114,10 @@ def test_simple():
114
114
# ax = plt.subplot(121, projection='hammer')
115
115
# recursive_pickle(ax, 'figure')
116
116
# pickle.dump(ax, BytesIO(), pickle.HIGHEST_PROTOCOL)
117
+
118
+ plt .figure ()
119
+ plt .bar (left = range (10 ), height = range (10 ))
120
+ pickle .dump (plt .gca (), BytesIO (), pickle .HIGHEST_PROTOCOL )
117
121
118
122
fig = plt .figure ()
119
123
ax = plt .axes ()
You can’t perform that action at this time.
0 commit comments