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