@@ -162,7 +162,7 @@ def mpl_execfile(fname,*where,**kw):
162
162
properly handle interactive rendering."""
163
163
164
164
import matplotlib
165
- import matplotlib .pylab as pylab
165
+ import matplotlib .pyplot as plt
166
166
167
167
#print '*** Matplotlib runner ***' # dbg
168
168
# turn off rendering until end of script
@@ -171,9 +171,17 @@ def mpl_execfile(fname,*where,**kw):
171
171
safe_execfile (fname ,* where ,** kw )
172
172
matplotlib .interactive (is_interactive )
173
173
# make rendering call now, if the user tried to do it
174
- if pylab .draw_if_interactive .called :
175
- pylab .draw ()
176
- pylab .draw_if_interactive .called = False
174
+ if plt .draw_if_interactive .called :
175
+ plt .draw ()
176
+ plt .draw_if_interactive .called = False
177
+
178
+ # re-draw everything that is stale
179
+ try :
180
+ da = plt .draw_all
181
+ except AttributeError :
182
+ pass
183
+ else :
184
+ da ()
177
185
178
186
return mpl_execfile
179
187
@@ -301,12 +309,12 @@ def activate_matplotlib(backend):
301
309
302
310
# This must be imported last in the matplotlib series, after
303
311
# backend/interactivity choices have been made
304
- import matplotlib .pylab as pylab
312
+ import matplotlib .pyplot as plt
305
313
306
- pylab .show ._needmain = False
314
+ plt .show ._needmain = False
307
315
# We need to detect at runtime whether show() is called by the user.
308
316
# For this, we wrap it into a decorator which adds a 'called' flag.
309
- pylab .draw_if_interactive = flag_calls (pylab .draw_if_interactive )
317
+ plt .draw_if_interactive = flag_calls (plt .draw_if_interactive )
310
318
311
319
312
320
def import_pylab (user_ns , import_all = True ):
0 commit comments