-
Notifications
You must be signed in to change notification settings - Fork 293
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
"%matplotlib notebook" not working in jupyter notebook #4056
Comments
Even though its working when creating local server with cmd "jupyter notebook", but not working inside vscode. |
@Bipul-Harsh Sorry about the issue. Pulling your logs here would be the most helpful thing. In VS Code settings set Jupyter->Logging->Level to "debug." Then re-run your scenario. After that copy out the contents of the Output window Jupyter tab. That should have most of the info to help us debug this. Also, when running your code in VS Code are you using the same environment as you are using when running "jupyter notebook" directly? |
ReferenceError: IPython is not defined |
This is what actually written in error. |
Regarding the environment both are using the same python3 version installed in my pc. The jupyter notebook I run on cmd opens default web browser for interface while in vscode it with MS python extension it opens within it. |
I think there might be some feature missing in the extension regarding IPython, as regarding normal plotting with matplotlib it didnt didnt give any error, but with Interactive plotting it gives error. While running on browser offline with local server it works for interactive plotting also, so that could be the issue. |
So, I hope I have provided the info needed |
@Bipul-Harsh Thanks for the info. I poked around a bit more, and found that we don't actually support the notebook mode for matplot lib currently. Seems like you can try using the widget mode instead, which should work as we support IPyWidgets. |
Environment data
Expected behaviour
Should show interactive window
Actual behaviour
Error Reporting:
ReferenceError: IPython is not defined
Steps to reproduce:
[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]
##Start
import numpy as np
import matplitlib.pyplot as plt
import matplotlib.animation as animation
n = 100
x = np.random.randn(n)
def update(curr):
#check if animation is at the last frame, and if so, stop the animation a
if curr == n:
a.event_source.stop()
plt.cla()
bins = np.arange(-4, 4, 0.5)
plt.hist(x[:curr], bins=bins)
plt.axis([-4,4,0,30])
plt.gca().set_title('Sampling the Normal Distribution')
plt.gca().set_ylabel('Frequency')
plt.gca().set_xlabel('Value')
plt.annotate('n = {}'.format(curr), [3,27])
fig = plt.figure()
a = animation.FuncAnimation(fig, update, interval=100)
##END
Logs
Output for
Jupyter
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toJupyter
)The text was updated successfully, but these errors were encountered: