-
Notifications
You must be signed in to change notification settings - Fork 1.4k
WIP/ENH: pyplot internals #906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Invoking %pylab inline resolves our block issue. |
travis is not happy: File "/home/travis/virtualenv/python2.7_with_system_site_packages/lib/python2.7/site-packages/mne-0.7.git-py2.7.egg/mne/viz.py", line 1241, in plot_evoked |
This shows us that we don't control whether pyplot is really used. The pyplot figure hase a show method, the pylab hasn't ... |
Here's a helpful discussion of the problem. Will look into it tonight. |
@agramfort WDYT about my last commit. |
if show: | ||
plt.show() | ||
if show and plt.get_backend() != 'agg': | ||
fig.show() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about if
hasattr(fig, 'show')
?
would that work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's almost equivalent ...
The reasons leading to fig objects without show method are backend-related. E.g. 'Agg' as used in tests will produce such objects while plt.show
calls would just pass and do nothing.
The variant I proposed would allow us to learn about additional backends / constellations where this fails ...
But I'm fine with going for attribute checking.
Point taken |
In part addresses #903
probably more examples need to be updated.
This also addresses the matplotlib issues with Anaconda (should now work without self compiled matplotlib) reported in #728 by @kambysese.
We're now able to understand the reasons and extract two insigths:
In addition many inconveniences can be avoided by explicitly invoking %pylab inline in a notebook.
This should be added to the docs.
You can checkout this notebook for exploring:
http://nbviewer.ipython.org/7533330
The multi-axis figures now work in the notebook.
The block thing still needs a fix.