Project [Python 2.7] - 2D Gaussian distribution for three clusters [K-means]
<p>I am new one here and new in python programming so I need some help. I need to make project for faculty about K-means clustering and about 2D Gaussian distribution. I have complete programming for three clusters but I have no idea have to make 2D Gaussian for the three clusters.</p>

<p>Here is my algorithm which have I used to show K-means algorithm [I am from Croatia so there are some words from my language]:</p>

<p>I need to make 2D Gaussian distribution after this algorithm. Can you help me guys?</p>

<pre><code>enter code here

  import numpy as np
  import matplotlib.pyplot as plt
  from mpl_toolkits.mplot3d import Axes3D
  from sklearn.cluster import KMeans
  from sklearn import datasets
  from scipy.optimize import curve_fit

 np.random.seed(5)

centers = [[1, 1], [-1, -1], [1, -1]]
iris = datasets.load_iris()
X = iris.data
y = iris.target

estimators = {'k_means_iris_3': KMeans(n_clusters=3),
          'k_means_iris_8': KMeans(n_clusters=8),
          'k_means_iris_bad_init': KMeans(n_clusters=3, n_init=1,
                                          init='random')}

fignum = 1
for name, est in estimators.items():
fig = plt.figure(fignum, figsize=(4, 3))
plt.clf()
ax = Axes3D(fig, rect=[0, 0, .95, 1], elev=48, azim=134)

plt.cla()
est.fit(X)
labels = est.labels_

ax.scatter(X[:, 3], X[:, 0], X[:, 2], c=labels.astype(np.float))

ax.w_xaxis.set_ticklabels([])
ax.w_yaxis.set_ticklabels([])
ax.w_zaxis.set_ticklabels([])
ax.set_xlabel('Sirina latica')
ax.set_ylabel('Duljina latica')
fignum = fignum + 1


fig = plt.figure(fignum, figsize=(4, 3))
plt.clf()
ax = Axes3D(fig, rect=[0, 0, .95, 1], elev=48, azim=134)

plt.cla()

for name, label in [('Zelena', 0),
                ('Crvena', 1),
                ('Plava', 2)]:
 ax.text3D(X[y == label, 3].mean(),
          X[y == label, 0].mean() + 1.5,
          X[y == label, 2].mean(), name,
          horizontalalignment='center',
          bbox=dict(alpha=.5, edgecolor='w', facecolor='w'))

 y = np.choose(y, [1, 2, 0]).astype(np.float)
 ax.scatter(X[:, 3], X[:, 0], X[:, 2], c=y)

 ax.w_xaxis.set_ticklabels([])
 ax.w_yaxis.set_ticklabels([])
 ax.w_zaxis.set_ticklabels([])
 ax.set_xlabel('Sirina latica')
 ax.set_ylabel('Duljina latica')
 plt.show()

`enter code here`
</code></pre>