Exemple #1
0
 def _plot_centroids(self, ax):
     # plot centroids
     bx = DataFrame(np.array(self._centroids)).plot(ax=ax, kind="scatter", x=0, y=1, figsize=FIG_SIZE, color="red")
     # annotate centroids
     for i in range(self._k):
         (x, y) = tuple(self._centroids[i])
         (offset_x, offset_y) = tuple(np.array(self._dim_lengths) / float(100))
         bx.annotate(u'µ_' + str(i + 1), xy=(x, y), xytext=(x + offset_x, y + offset_y))