Created
June 27, 2018 05:11
-
-
Save codeAshu/ad6c5abc8b0301a44a25a1709bb4534e to your computer and use it in GitHub Desktop.
cluster plot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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