How do you color the scatter points based on their index? For instance, I would like points with smaller indices to have a lighter colour of the Blues colormap and the ones with larger indices to have a darker colour.
from numpy.random import randn
import matplotlib.pyplot as plt
points = randn(20, 2)
plt.scatter(*points.T)
CodePudding user response:
Look at this one
x = range(20)
plt.scatter(x, x, c=x, cmap=plt.get_cmap('Blues'))
It seems you can just pass the indices to c argument
