File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -1358,11 +1358,18 @@ def __setstate__(self, state):
13581358
13591359 if restore_to_pylab :
13601360 # lazy import to avoid circularity
1361+ # XXX clean on removal of Gcf from backends
13611362 import matplotlib .pyplot as plt
13621363 import matplotlib ._pylab_helpers as pylab_helpers
1364+ import matplotlib .backend_managers as managers
13631365 allnums = plt .get_fignums ()
13641366 num = max (allnums ) + 1 if allnums else 1
1365- mgr = plt ._backend_mod .new_figure_manager_given_figure (num , self )
1367+ if managers .old_new_figure_manager :
1368+ mgr = plt ._backend_mod .new_figure_manager_given_figure (num ,
1369+ self )
1370+ mgr .mainloop = plt ._show
1371+ else :
1372+ mgr = managers .new_figure_manager_given_figure (num , self )
13661373
13671374 # XXX The following is a copy and paste from pyplot. Consider
13681375 # factoring to pylab_helpers
@@ -1377,7 +1384,7 @@ def make_active(event):
13771384 mgr ._cidgcf = mgr .canvas .mpl_connect ('button_press_event' ,
13781385 make_active )
13791386
1380- pylab_helpers .Gcf .set_active (mgr )
1387+ pylab_helpers .Gcf .add_figure_manager (mgr )
13811388 self .number = num
13821389
13831390 plt .draw_if_interactive ()
You can’t perform that action at this time.
0 commit comments