title: Spaghetti plot without a for loop
body: <p>I want to make a spaghetti plot (lots of lines in one window) using <code>matplotlib.pyplot</code>. Different lines need to be different colors based on my data. However, I do not want to use a for loop for each line because I need it to work fast. I'm using matplotlib event handling and replotting over 200 lines based on mouse drag; a for loop takes too long for that.</p>
  <p>While there isn't any documentation on this I found out that if you use <code>plt.plot</code> and pass on an array for x and a matrix for y it prints out multiple lines. And it's super fast. However all of them have to be the same color. And passing on an array for color results in an error.</p>
  <pre class="lang-py prettyprint-override"><code>_ = plt.plot([0,1,2,3,4], np.matrix.transpose(np.asarray([[0,0,0,0,0],[1,1,1,1,1],[2,2,2,2,2]])), color='blue', linewidth=1, alpha=0.4) 
  </code></pre>
  <p>This code produces 3 horizontal lines in one plot and takes faster than using the plot command 3 times. This is great, but i want different colors. If i do</p>
  <pre><code>_ = plt.plot([0,1,2,3,4], np.matrix.transpose(np.asarray([[0,0,0,0,0],[1,1,1,1,1],[2,2,2,2,2]])), color=['blue', 'red, 'green'], linewidth=1, alpha=0.4) 
  </code></pre>
  <p>I get an error <code>Invalid RGBA argument: array(['blue', 'red', 'red'], dtype='&lt;U4')</code></p>