I want to do a simple matplotlib animation plot in the Jupyter Notebook using the following code:
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import make_classification
import matplotlib.animation as animation
X,y_train = make_classification(n_samples=100,n_features=2,n_informative=2,n_redundant=0,n_clusters_per_class =1,shift=0,class_sep=1.9)
fig = plt.figure(figsize=(10,8))
ax = fig.add_subplot(1,1,1)
def update(num,X,y_train):
ax.scatter(X[:num,0],X[:num,1])
ani = animation.FuncAnimation(fig,update,frames=10,interval=1000,fargs=[X,y_train])
plt.show()
But I do not receive any plot... Just an empty figure like:
I have also tried without $matplotlib inline but it is still not working. Can anybody help me please?