Show More
@@ -205,23 +205,20 b' def activate_matplotlib(backend):' | |||
|
205 | 205 | """Activate the given backend and set interactive to True.""" |
|
206 | 206 | |
|
207 | 207 | import matplotlib |
|
208 | if backend.startswith('module://'): | |
|
209 | # Work around bug in matplotlib: matplotlib.use converts the | |
|
210 | # backend_id to lowercase even if a module name is specified! | |
|
211 | matplotlib.rcParams['backend'] = backend | |
|
212 | else: | |
|
213 | matplotlib.use(backend) | |
|
214 | 208 | matplotlib.interactive(True) |
|
215 | 209 | |
|
210 | # Matplotlib had a bug where even switch_backend could not force | |
|
211 | # the rcParam to update. This needs to be set *before* the module | |
|
212 | # magic of switch_backend(). | |
|
213 | matplotlib.rcParams['backend'] = backend | |
|
214 | ||
|
215 | import matplotlib.pyplot | |
|
216 | matplotlib.pyplot.switch_backend(backend) | |
|
217 | ||
|
216 | 218 | # This must be imported last in the matplotlib series, after |
|
217 | 219 | # backend/interactivity choices have been made |
|
218 | 220 | import matplotlib.pylab as pylab |
|
219 | 221 | |
|
220 | # XXX For now leave this commented out, but depending on discussions with | |
|
221 | # mpl-dev, we may be able to allow interactive switching... | |
|
222 | #import matplotlib.pyplot | |
|
223 | #matplotlib.pyplot.switch_backend(backend) | |
|
224 | ||
|
225 | 222 | pylab.show._needmain = False |
|
226 | 223 | # We need to detect at runtime whether show() is called by the user. |
|
227 | 224 | # For this, we wrap it into a decorator which adds a 'called' flag. |
General Comments 0
You need to be logged in to leave comments.
Login now