Skip to content

Instantly share code, notes, and snippets.

@codeAshu
Created February 1, 2019 06:12
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/ac29a16ed47e43b419a6f57d96c8344d to your computer and use it in GitHub Desktop.
Save codeAshu/ac29a16ed47e43b419a6f57d96c8344d to your computer and use it in GitHub Desktop.
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