I donβt know if you can automatically change the color, but you can use your loop to generate different colors:
for i in range(20): ax1.plot(x, y, color = (0, i / 20.0, 0, 1)
In this case, the colors will range from black to 100% green, but you can customize it if you want.
See matplotlib plot () docs and find the color keyword argument.
If you want to serve a list of colors, just make sure you have a list large enough, then use the loop index to select the color
colors = ['r', 'b', ...., 'w'] for i in range(20): ax1.plot(x, y, color = colors[i])
Andrea Spadaccini Feb 11 '11 at 16:15 2011-02-11 16:15
source share