4

Let's say I want to plot and i have a 1d array for x and a 2d array for y. That is, i want to plot multiple lines. I want each line to have its own color. The colors seem to run out - they start to repeat. What is the easiest way to get distinct colors for many lines?

This shows that the colors repeat:

aa=np.array(range(10),range(20))
bb=np.array(range(0,100,1)).reshape(10,10)
fig = plt.figure()
ax=plt.subplot(111)
ax.plot(aa,bb)
fig.savefig('sample.png')
user2015487
  • 2,075
  • 3
  • 17
  • 20
  • possible duplicate of [default color cycle with matplotlib](http://stackoverflow.com/questions/9397944/default-color-cycle-with-matplotlib) – aruisdante Jul 24 '14 at 17:13
  • possible duplicate of [How to pick a new color for each plotted line within a figure in matplotlib?](http://stackoverflow.com/questions/4971269/how-to-pick-a-new-color-for-each-plotted-line-within-a-figure-in-matplotlib) – Gerrat Jul 24 '14 at 17:21
  • possible duplicate of [Plotting with more colors in matplotlib](https://stackoverflow.com/questions/22995352/plotting-with-more-colors-in-matplotlib) – DataMan Jan 22 '18 at 19:18

0 Answers0