Jun-23-2020, 09:47 AM
Hello,
I am new and trying to write a 4 by 4 scatter matrix using for loop and subplot functions. The data is iris. I have run this code but nothing is getting returned. Please review it and advise,what went wrong, thanks.
I am new and trying to write a 4 by 4 scatter matrix using for loop and subplot functions. The data is iris. I have run this code but nothing is getting returned. Please review it and advise,what went wrong, thanks.
from sklearn import datasets import matplotlib.pyplot as plt %matplotlib inline iris = datasets.load_iris() X=iris.data Y=iris.target t= 1 for i in range (0,4): for j in range (0,4): ax = fig.add_subplot(4,4,t) ax.scatter(X[:, i], X[:, j], c=Y, cmap=plt.cm.Paired) t=t+1 plt.show()