matplotlib-aware wrapper around safe_execfile. Its interface is identical to that of the :func:`execfile` builtin. This is ultimately a call to execfile(), but wrapped in safeties to properly handle interactive rendering.
(fname,*where,**kw)
| 164 | """ |
| 165 | |
| 166 | def mpl_execfile(fname,*where,**kw): |
| 167 | """matplotlib-aware wrapper around safe_execfile. |
| 168 | |
| 169 | Its interface is identical to that of the :func:`execfile` builtin. |
| 170 | |
| 171 | This is ultimately a call to execfile(), but wrapped in safeties to |
| 172 | properly handle interactive rendering.""" |
| 173 | |
| 174 | import matplotlib |
| 175 | import matplotlib.pyplot as plt |
| 176 | |
| 177 | #print '*** Matplotlib runner ***' # dbg |
| 178 | # turn off rendering until end of script |
| 179 | is_interactive = matplotlib.rcParams['interactive'] |
| 180 | matplotlib.interactive(False) |
| 181 | safe_execfile(fname,*where,**kw) |
| 182 | matplotlib.interactive(is_interactive) |
| 183 | # make rendering call now, if the user tried to do it |
| 184 | if plt.draw_if_interactive.called: |
| 185 | plt.draw() |
| 186 | plt.draw_if_interactive.called = False |
| 187 | |
| 188 | # re-draw everything that is stale |
| 189 | try: |
| 190 | da = plt.draw_all |
| 191 | except AttributeError: |
| 192 | pass |
| 193 | else: |
| 194 | da() |
| 195 | |
| 196 | return mpl_execfile |
| 197 |
nothing calls this directly
no outgoing calls
no test coverage detected