matplotlib scatter plot colour as function of third variable [duplicate]
This works for me, using matplotlib 1.1: 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() Result: Alternatively, for n points, make an array of RGB color values with shape (n, 3), and assign it to the edgecolors keyword argument of scatter(): … Read more