x = np.linspace(0, 10, 1000)
y = np.sin(2 * np.pi * x)
cmap = cm.jet
fig = plt.figure(1)
fig.clf()
ax = fig.add_subplot(1, 1, 1)
c = np.linspace(0, 10, 1000)
ax.scatter(x, y, c=c, cmap=cmap)
matplotlib - change marker color along plot line