-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Add show() method to figure objects. #1615
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
See ipython#1612 and matplotlib/matplotlib#835 for more details.
I should add that I have no way of unit-testing this, because it's simply up to checking that in various interactive use scenarios, the expected number of figures are displayed inline (it's easy to get spurious copies by mistake). Since that's a purely visual check, that's what I did. As provided by @dwf, here's a snippet that runs fine in import numpy as np
import matplotlib.pyplot as plt
plt.ioff()
x = np.random.uniform(-5, 5, size=(100))
y = np.random.uniform(-5, 5, size=(100))
f = plt.figure()
plt.scatter(x, y)
plt.plot(y)
f.show() ps - this could in principle be unittested, but it would be a really tricky test to write involving a 2-process check of objects being sent over the messaging channels. While it would be great to have machinery for such tests in the long run, that's a whole project by itself which I can't tackle right now. |
@fperez - for things that cannot (or at least not easily) be unittested, @takluyver and I have been putting scripts in docs/examples/tests (actually, his is in examples/test_embed, which should probably be moved into docs/examples/tests), to at least ease reproduction. |
Good idea, I'll do that now... |
@fperez Yep, it seems to do the job for me. (I should note that in the case I was using it, the stuff I wanted to see was getting plotted, just after an annoying traceback.) Thanks! |
thanks for the info, @dwf. Yes, it was getting shown because we still track that drawing happened and flush the drawing pipeline at the end of execution. But this is the right fix for this problem, thanks for confirming. |
Ok, manual test pushed, thanks @minrk for the tip. I didn't want to do the cleanup of @takluyver's directory here, but I agree we should merge those manual tests into a single dir and put up a notice in the dev guide about it. |
I think this looks good. |
Great, thanks everyone for the review. Merging now. |
Add show() method to figure objects. This is a hack, but needed to match the monkeypatching applied by matplotlib in some backends (not all). See #1612 and matplotlib/matplotlib#835 for more details. Closes #1612.
Add show() method to figure objects. This is a hack, but needed to match the monkeypatching applied by matplotlib in some backends (not all). See ipython#1612 and matplotlib/matplotlib#835 for more details. Closes ipython#1612.
This is a hack, but needed to match the monkeypatching applied by mpl in some backends (not all).
See #1612 and matplotlib/matplotlib#835 for more.
Closes #1612.