I recently came across the following code:
In : size = 50*np.random.randn(100)
In : colours = np.random.rand(100)
In : scatter(x, y, s=size, c=colours);
In : show()
which works beautifully. My question though is this: why?
I came to understand, with Google's help, that the randomly generated
values (ranging between 0.0 and 1.0) for the variable colours are mapped
to a color table, so that the generated value of, say, 0.21985792 is
linked to a given color. This color is then used to paint one scatter point.
I was unable to find helpful (i.e. newbie friendly) information on how
this color mapping exactly works. Where is the table? The matplotlib
documentation caused me confusion.
Thanks for your kind help,