making scatter plot with different colors for different groups using matplotlib.pyploy

Viewed 593

I am trying to make a scatter plot for my data using matplotlib.pyplot (which is imported as plt) and using the following command:

fig = plt.figure(1, figsize = (10, 6))
plt.figure()
plt.scatter(X_train_reduced[:, 0],  X_train_reduced[:, 1], c = y_train, cmap = plt.cm.Paired , linewidths=10)

but it gives this error:

ValueError: 'c' argument must be a mpl color, a sequence of mpl colors or a sequence of numbers, not sample group

when I remove this argument:

c = y_train

it returns the plot but the same color for all groups (I have 2 groups). do you know how to fix it?

0 Answers
Related