Issue
I'd like to NOT specify a color for each plotted line, and have each line get a distinct color. But if I run:
from matplotlib import pyplot as plt
for i in range(20):
plt.plot([0, 1], [i, i])
plt.show()
then I get this output:
If you look at the image above, you can see that matplotlib attempts to pick colors for each line that are different, but eventually it re-uses colors - the top ten lines use the same colors as the bottom ten. I just want to stop it from repeating already used colors AND/OR feed it a list of colors to use.
Solution
matplotlib 1.5+
You can use axes.set_prop_cycle
(example).
matplotlib 1.0-1.4
You can use axes.set_color_cycle
(example).
matplotlib 0.x
You can use Axes.set_default_color_cycle
.
Answered By - tom10
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.