Consider the following MWE
import matplotlib.pyplot as plt
l = [8, 5, 7, 10, 3, 3, 7, 5, 2, 6]
plt.plot(range(len(l)), l, marker=".", markersize=20)
I would like the line segments to be colored according to the contents of l
. So the first segment would be color 8
, the second color 5
etc. I don't mind too much which color pallete these colors are chosen from as long as the colors are clearly distinct.
How can you do that?