File tree 1 file changed +9
-2
lines changed
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):
1358
1358
1359
1359
if restore_to_pylab :
1360
1360
# lazy import to avoid circularity
1361
+ # XXX clean on removal of Gcf from backends
1361
1362
import matplotlib .pyplot as plt
1362
1363
import matplotlib ._pylab_helpers as pylab_helpers
1364
+ import matplotlib .backend_managers as managers
1363
1365
allnums = plt .get_fignums ()
1364
1366
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 )
1366
1373
1367
1374
# XXX The following is a copy and paste from pyplot. Consider
1368
1375
# factoring to pylab_helpers
@@ -1377,7 +1384,7 @@ def make_active(event):
1377
1384
mgr ._cidgcf = mgr .canvas .mpl_connect ('button_press_event' ,
1378
1385
make_active )
1379
1386
1380
- pylab_helpers .Gcf .set_active (mgr )
1387
+ pylab_helpers .Gcf .add_figure_manager (mgr )
1381
1388
self .number = num
1382
1389
1383
1390
plt .draw_if_interactive ()
You can’t perform that action at this time.
0 commit comments