import numpy as np
import matplotlib.pyplot as plt
x = np.arange(10)
y = np.sin(x)
plt.scatter(x, y, marker='+', s=150, linewidths=4, c=y, cmap=plt.cm.coolwarm)
plt.show()
matplotlib scatter plot colour as function of third variable