Skip to content

Instantly share code, notes, and snippets.

@codeAshu
Created June 27, 2018 05:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codeAshu/ad6c5abc8b0301a44a25a1709bb4534e to your computer and use it in GitHub Desktop.
Save codeAshu/ad6c5abc8b0301a44a25a1709bb4534e to your computer and use it in GitHub Desktop.
cluster plot
import pylab as pl
from itertools import cycle
def plot_2D(data, target, target_names):
colors = cycle('rgbcmykw')
target_ids = range(len(target_names))
pl.figure()
for i, c, label in zip(target_ids, colors, target_names):
pl.scatter(data[target == i, 0], data[target == i, 1],
c=c, label=label)
pl.legend()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment