When I place a notebook made in jupyter notebook in a jupyter lab, the following message appears: Javascript Error: IPython is not defined. I installed the jupyter lab just as the page says for windows 10 , ....... what's going on ? Here example of the code, this is what happens in jupyter lab:
%matplotlib notebook
import itertools
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.animation as animation
def data_gen():
for cnt in itertools.count():
t = cnt / 10
yield t, np.sin(2*np.pi*t) * np.exp(-t/10.)
def init():
ax.set_ylim(-1.1, 1.1)
ax.set_xlim(0, 1)
del xdata[:]
del ydata[:]
line.set_data(xdata, ydata)
return line,
fig, ax = plt.subplots()
line, = ax.plot([], [], lw=2)
ax.grid()
xdata, ydata = [], []
def run(data):
t, y = data
xdata.append(t)
ydata.append(y)
xmin, xmax = ax.get_xlim()
if t >= xmax:
ax.set_xlim(xmin, 2*xmax)
ax.figure.canvas.draw()
line.set_data(xdata, ydata)
return line,
ani = animation.FuncAnimation(fig, run, data_gen, interval=100, init_func=init,
save_count=100)
plt.show()
Javascript Error: IPython is not defined
C:\Users\marc_arias\AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\animation.py:879: UserWarning: Animation was deleted without rendering anything. This is most likely not intended. To prevent deletion, assign the Animation to a variable, e.g. `anim`, that exists until you output the Animation using `plt.show()` or `anim.save()`.
warnings.warn(