title: 3D scatter plot colorbar matplotlib Python
body: <p>I cannot add a colorbar to my 3D scatter plot that is coloured in range of <code>min</code> and <code>max</code> according to the value of <code>bifurWidth</code>. I've tried various attempts shown on stackoverflow, none have had any success. Any help would really be appreciated, as I am at a major loss with this. </p>
  
  <p>My most recent attempt is hashed out of the code shown below.</p>
  
  <p>My code:</p>
  
  <pre><code>from glob import glob
  from pylab import *
  import numpy as np
  from matplotlib import cm
  from mpl_toolkits.mplot3d import Axes3D
  
  def myScatter(x0,y0,power_array,c,lw,s,vmin,vmax,cmap,label,ax):
          ax.scatter(x0,y0,power_array,c=c,lw=lw,s=s,vmin=min,vmax=max,cmap=cmhot,label=label)
  
  fig = figure()
  ax = fig.add_subplot(111, projection='3d')  
  cmhot = get_cmap("jet") 
  fig.tight_layout()
  fig.set_size_inches(25,15)
  
  min = 3 #colorbar range
  max = 10
  lw = 0 #linewidth
  s = 10 #scatter size
  
  for idx, p in enumerate(dataSorted[:,1]):
      powerLoop = dataSorted[idx,0]
      powerLoop = powerLoop.astype(np.float)
      bifurWidthLoop = dataSorted[idx,2]
      bifurWidthLoop = bifurWidthLoop.astype(np.float)
  
      y0 = genfromtxt(p, unpack=True, usecols=[0], skiprows=19, skip_footer=1)
  
      length = len(x0)
      power_array = [powerLoop] * length
      bifurWidth_array = [bifurWidthLoop] * length
      label = str(bifurWidth)
  
      a = myScatter(x0,power_array,y0,bifurWidth_array,lw,s,min,max,cmhot,label,ax)
  
      #cax = ax.imshow(y0, interpolation='nearest', vmin=min, vmax=max)
      #fig.colorbar(cax)
  fig.savefig('test.png',dpi=300)
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/44SuZ.png" alt="Plot output"></p>
  
  <p>Example of an attempt and its error:</p>
  
  <p>If I use <code>fig.colorbar(a)</code> inside or outside of the plotting <code>for</code> loop, I return <code>NoneType</code> oject has no attribute <code>autoscale_None</code>.</p>