What\'s the trivial example of how to generate random colors for passing to plotting functions?
I\'m calling scatter inside a loop and want each plot a different col
Here is a more concise version of Ali's answer giving one distinct color per plot :
import matplotlib.pyplot as plt N = len(data) cmap = plt.cm.get_cmap("hsv", N+1) for i in range(N): X,Y = data[i] plt.scatter(X, Y, c=cmap(i))