WebAgg: pylab compatibility #1651

merged 1 commit into from Jan 14, 2013


None yet

3 participants

mdboom commented Jan 10, 2013

Fixes #1638 in a temporary way so that WebAgg works with ipython --pylab. Once the IPython side of the integration is complete, this will probably no longer be necessary.

@pelson pelson commented on the diff Jan 10, 2013
@@ -100,6 +101,10 @@ def __call__(self, block=None):
# IPython versions >= 0.10 tack the _needmain
# attribute onto pyplot.show, and always set
# it to False, when in --pylab mode.
+ ipython_pylab = ipython_pylab and get_backend() != 'WebAgg'
+ # TODO: The above is a hack to get the WebAgg backend
+ # working with `ipython --pylab` until proper integration
+ # is implemented.
pelson Jan 10, 2013 Member

Hmm. I'm sure you feel the same, but I'm not a fan of matplotlib knowing about ipython - I would sooner leave hooks so that ipython can make matplotlib know about it. Obviously, that isn't going to happen here, but is something that I will keep in the back of my mind as something we could improve in the future.

Other than that, I wonder what get_backend does and whether this plays nice with those brave souls who use the mpl OO interface (@dmcdougall I'm looking at you here 😄)?

mdboom Jan 10, 2013 Owner

show shouldn't really come into play with the OO interface. This is really only relevant to the non-OO (matlab-style) interface.

I agree -- it would be nice to have matplotlib know less about IPython, but there's currently a very elaborate dance that the two projects do to make ipython --pylab work as well as it does. I think things are already better than they used to be, if you can believe it, in that IPython monkey-patches hooks in matplotlib in many cases, rather than matplotlib needing to have them already in place. But there's always more work to be done in that regard.

bmu commented Jan 11, 2013

It works, however the prompt is blocked by the server.

@bmu bmu commented on the diff Jan 11, 2013
@@ -41,6 +41,7 @@
#import matplotlib.path as path
from matplotlib import rcParams
from matplotlib import is_interactive
+from matplotlib import get_backend
bmu Jan 11, 2013

Not sure, but I think this import is not necessary, as pyplot is imported in ShowBase.__call__ and you can use pyplot.get_backend.

mdboom commented Jan 14, 2013

Merging this and opening #1658 to propose non-blocking.

@mdboom mdboom merged commit e02c375 into matplotlib:master Jan 14, 2013

1 check failed

default The Travis build failed
@mdboom mdboom deleted the mdboom:webagg/pylab_compatibility branch Aug 7, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment