@@ -107,6 +107,8 @@ def test_simple():
107107 plt .plot (list (xrange (10 )), label = 'foobar' )
108108 plt .legend ()
109109
110+ # Uncomment to debug any unpicklable objects. This is slow so is not
111+ # uncommented by default.
110112# recursive_pickle(fig)
111113 pickle .dump (ax , BytesIO (), pickle .HIGHEST_PROTOCOL )
112114
@@ -217,12 +219,25 @@ def test_image():
217219 from matplotlib .backends .backend_agg import new_figure_manager
218220 manager = new_figure_manager (1000 )
219221 fig = manager .canvas .figure
220- ax = fig .add_subplot (1 ,1 , 1 )
222+ ax = fig .add_subplot (1 , 1 , 1 )
221223 ax .imshow (np .arange (12 ).reshape (3 , 4 ))
222224 manager .canvas .draw ()
223225 pickle .dump (fig , BytesIO ())
224226
225227
228+ def test_grid ():
229+ from matplotlib .backends .backend_agg import new_figure_manager
230+ manager = new_figure_manager (1000 )
231+ fig = manager .canvas .figure
232+ ax = fig .add_subplot (1 , 1 , 1 )
233+ ax .grid ()
234+ # Drawing the grid triggers instance methods to be attached
235+ # to the Line2D object (_lineFunc).
236+ manager .canvas .draw ()
237+
238+ pickle .dump (ax , BytesIO ())
239+
240+
226241if __name__ == '__main__' :
227242 import nose
228243 nose .runmodule (argv = ['-s' ])
0 commit comments