How does this c=Y, work we are passing numpy array no... how the colurs are given to the scattered dots

how does this c=Y, work we are passing numpy array no…
how the colurs are given to the scattered dots

Hey @ajaysiddartha, so the scatter function has this parameter called c. It works somewhat like this :

c : color, sequence, or sequence of color, optional

The marker color. Possible values:

1. A single color format string.
2. A sequence of color specifications of length n.
3. A sequence of n numbers to be mapped to colors using cmap and norm.
4. A 2-D array in which the rows are RGB or RGBA. 

So when you pass a numpy array, the method counts the number of unique elements in the array and accordingly assigns colour to every unique element.

I hope this helps ! :+1:
Happy Learning ! :slightly_smiling_face:

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.