title: Adding a colorbar to python subplots where color of datapoint depends on a third variable not plotted
body: <p>Hi I'm really stuck trying to add a colorbar to my plot.</p>
  
  <p>I have five 1D arrays, time, x and p,q,r that are all the same length. I want to plot x vs p, x vs q and x vs r but color code each with respect to time so that I can see how the data evolves in time.</p>
  
  <p>I have managed to do this using the answer to <a href="https://stackoverflow.com/questions/23916201/python-line-colour-of-3d-parametric-curve">Python - Line colour of 3D parametric curve</a> as an example. This is my code:</p>
  
  <pre><code>import matplotlib.pyplot as plt
  import numpy as np
  from numpy import *
  from matplotlib import colors
  
  time, x, p, q, r = loadtxt('data.txt', unpack = True)
  
  cn = colors.Normalize(min(time), max(time))
  
  fig, (axes1, axes2, axes3) = plt.subplots(1,3)
  
  for i in range(len(time)):
      axes1.plot(x[i], p[i], '.', color=plt.cm.jet(cn(time[i])))
      axes2.plot(x[i], q[i], '.', color=plt.cm.jet(cn(time[i])))
      axes3.plot(x[i], r[i], '.', color=plt.cm.jet(cn(time[i])))
  
  plt.show()
  </code></pre>
  
  <p>But now I'm stuck trying to add a color bar to this plot so the colors of the points have some meaning.</p>
  
  <p>I've tried using something similar to <a href="https://stackoverflow.com/questions/13784201/matplotlib-2-subplots-1-colorbar">Matplotlib 2 Subplots, 1 Colorbar</a> but I'm not sure about the mappable im and imshow in general.</p>
  
  <p>Any help would be much appreciated!
  Thanks</p>