File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -32,6 +32,13 @@ def remove(self):
3232 if self ._remove_method :
3333 self ._remove_method (self )
3434
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+
3542 def get_label (self ):
3643 """
3744 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():
114114# ax = plt.subplot(121, projection='hammer')
115115# recursive_pickle(ax, 'figure')
116116# 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 )
117121
118122
119123@image_comparison (baseline_images = ['multi_pickle' ],
You can’t perform that action at this time.
0 commit comments