-1

I have a numpy vector of shape (2000, 2), and for each element (x,y) of each row I have an associated label in a numpy vector of shape (2000, 1). The labels are just an integer that can be either of the following 1,2,3,4,5,6

how can I have a scatter plot where the color of each point is different based on its label ?

AnarKi
  • 857
  • 1
  • 7
  • 27

1 Answers1

0

You can provide the integer labels through directly into the color argument of the scatter function

import numpy as np
import matplotlib.pyplot as plt

plt.scatter( data[:,0], data[:,1], c=labels )
plt.show()
Gabriel M
  • 1,486
  • 4
  • 17
  • 25