I was running some code in spyder, but decided that I needed it to be more presentable, so I copied and pasted it directly into notebook. When I did, the plots changed.
here is the code that I copied:
from sklearn.mixture import GMM
import pandas as pd
from sklearn import datasets
import matplotlib.pyplot as plt
import itertools
import warnings
warnings.filterwarnings("ignore")
iris = datasets.load_iris()
x = iris.data
y = iris.target
lala = []
gmm = GMM(n_components=3).fit(x)
labels = gmm.predict(x)
fig, axes = plt.subplots(4, 4)
Superman = iris.feature_names
markers = ["*" , "+" , "s", "o"]
colors = ["red", "green", "blue", "black"]
Mi=[]
for i in range(150):
Mi.append(markers[y[i]])
Z_Values = (gmm.predict_proba(x))
goalie = []
for i in range(len(Z_Values)):
row = Z_Values[i,:]
idx = row.argsort()
if(row[idx[-1]] - row[idx[-2]]< .15):
goalie.append(i)
# Comment this out when you are doing checks
labels[goalie] = 3
for i in range(4):
for j in range(4):
for k in range(x.shape[0]):
if(i != j):
axes[i, j].scatter(x[k, i], x[k, j], c=colors[labels[k]], marker = markers[y[k]], s=.5, cmap='viridis')
axes[i, j].tick_params(axis='both', which='both', bottom='off', top='off', labelbottom='off', right='off', left='off', labelleft='off')
else:
if k > 1:
pass
axes[i,j].text(0.1, 0.3, Superman[i], fontsize = 7)
axes[i, j].tick_params(axis='both', which='both', bottom='off', top='off', labelbottom='off', right='off', left='off', labelleft='off')
In spyder the subplots created are 3 colors (red, green, blue) and show up normally. When I use notebook, only the green points show. Here is an example of how it looks (sorry for the potato quality):
Any idea why this is happening? What is different between spyder and notebook that causes this? I notice that If I save my picture in spyder as a .png this also happens.