title: Python - Set zlim in mplot3D
body: <pre><code>mpl.rcParams['legend.fontsize'] = 10
  
  fig1 = plt.figure()
  ax = fig1.gca(projection='3d') 
  
  ax.plot(tab_C[0], tab_C[1], zs=0, zdir='z', label = "Projection de la trajectoire de C", color='k')
  ax.plot(tab_M[0], tab_M[1], zs=0, zdir='z', label = "Projection de la trajectoire de M", color='r')
  
  for i in range(0,len(tab_t)):
      ax.plot(tab_C[0][i:i+2], tab_C[1][i:i+2], tab_C[2][i:i+2], color=plt.cm.rainbow(255*i/len(tab_t)))
      ax.plot(tab_M[0][i:i+2], tab_M[1][i:i+2], tab_M[2][i:i+2], color=plt.cm.rainbow(255*i/len(tab_t)))
  
  ax.legend()
  
  ax.set_xlabel('I')
  ax.set_ylabel('J')
  ax.set_zlabel('K')
  
  m = cm.ScalarMappable(cmap=cm.rainbow)
  m.set_array(tab_t)
  
  plt.colorbar(m)
  </code></pre>
  
  <p>I've got this plot with my code</p>
  
  <p><img src="https://i.stack.imgur.com/DFCLN.png" alt="My plot"></p>
  
  <p>My problems are
  - I want to set label for the color bar but ScalarMappale don't have the methode set_label()
  - I want to set zmin=0 to see clearly the projection on the plan (0xy) but it seems that zmin here is 0.05 and when I do
      ax.set_zlim(bottom=0)
  It returns</p>
  
  <pre><code>Traceback (most recent call last):
    File "code.py", line 117, in &lt;module&gt;
      ax.set_zlim(bottom=0) 
    File "/usr/lib/pymodules/python2.7/mpl_toolkits/mplot3d/axes3d.py", line 515, in set_zlim3d
      lims = self._determine_lims(*args, **kwargs)
    File "/usr/lib/pymodules/python2.7/mpl_toolkits/mplot3d/axes3d.py", line 476, in _determine_lims
      xmin -= 0.05
  TypeError: unsupported operand type(s) for -=: 'NoneType' and 'float'
  </code></pre>
  
  <p>Is there any way to solve my problems?</p>