Matplotlib Scatter - ValueError: RGBA sequence should have length 3 or 4 Matplotlib Scatter - ValueError: RGBA sequence should have length 3 or 4 numpy numpy

Matplotlib Scatter - ValueError: RGBA sequence should have length 3 or 4


Your y array looks like

 ['3'] ['9'] ['0'] ['5'] ['5'] ['Triangle'] ['7'] ['9'] ['0'] ['0']...

while in reality it should look like

[3,9,0,5,5,5,7,9,0,0, ...]


I also ran into this error. In my case, the issue was that I was plot-ing when I meant to scatter. Changing

plt.plot(x1, x2, c=target)

to

plt.scatter(x1, x2, c=target)

fixed it.