import matplotlib.pyplot as plt
import numpy as np
t = np.linspace(0, 2 * np.pi, 20)
x = np.sin(t)
y = np.cos(t)
plt.scatter(t, x, c=y)
plt.show()
matplotlib: how to change data points color based on some variable