random color python code example
Example 1: generate a color python
color = lambda : [random.randint(0, 255), random.randint(0, 255), random.randint(0, 255)]
Example 2: python random hex color
import random
r = lambda: random.randint(0,255)
print('#%02X%02X%02X' % (r(),r(),r()))
Example 3: matplotlib random color
import random
# note that matplotlib requires 2d array for rbg colors
rgb = [[random.random(), random.random(), random.random()]]
plt.scatter(x, y, c=rgb)