Show More
@@ -162,7 +162,7 b' def mpl_runner(safe_execfile):' | |||||
162 | properly handle interactive rendering.""" |
|
162 | properly handle interactive rendering.""" | |
163 |
|
163 | |||
164 | import matplotlib |
|
164 | import matplotlib | |
165 |
import matplotlib.py |
|
165 | import matplotlib.pyplot as plt | |
166 |
|
166 | |||
167 | #print '*** Matplotlib runner ***' # dbg |
|
167 | #print '*** Matplotlib runner ***' # dbg | |
168 | # turn off rendering until end of script |
|
168 | # turn off rendering until end of script | |
@@ -171,9 +171,17 b' def mpl_runner(safe_execfile):' | |||||
171 | safe_execfile(fname,*where,**kw) |
|
171 | safe_execfile(fname,*where,**kw) | |
172 | matplotlib.interactive(is_interactive) |
|
172 | matplotlib.interactive(is_interactive) | |
173 | # make rendering call now, if the user tried to do it |
|
173 | # make rendering call now, if the user tried to do it | |
174 |
if p |
|
174 | if plt.draw_if_interactive.called: | |
175 |
p |
|
175 | plt.draw() | |
176 |
p |
|
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 | return mpl_execfile |
|
186 | return mpl_execfile | |
179 |
|
187 | |||
@@ -301,12 +309,12 b' def activate_matplotlib(backend):' | |||||
301 |
|
309 | |||
302 | # This must be imported last in the matplotlib series, after |
|
310 | # This must be imported last in the matplotlib series, after | |
303 | # backend/interactivity choices have been made |
|
311 | # backend/interactivity choices have been made | |
304 |
import matplotlib.py |
|
312 | import matplotlib.pyplot as plt | |
305 |
|
313 | |||
306 |
p |
|
314 | plt.show._needmain = False | |
307 | # We need to detect at runtime whether show() is called by the user. |
|
315 | # We need to detect at runtime whether show() is called by the user. | |
308 | # For this, we wrap it into a decorator which adds a 'called' flag. |
|
316 | # For this, we wrap it into a decorator which adds a 'called' flag. | |
309 |
p |
|
317 | plt.draw_if_interactive = flag_calls(plt.draw_if_interactive) | |
310 |
|
318 | |||
311 |
|
319 | |||
312 | def import_pylab(user_ns, import_all=True): |
|
320 | def import_pylab(user_ns, import_all=True): |
General Comments 0
You need to be logged in to leave comments.
Login now