title: Add a legend in a 3D scatterplot with scatter() in Matplotlib
body: <p>I want to create a 3D scatterplot with different datasets in the same plot and a legend with their labels. The problem I am facing is that I cannot properly add the legend and I get a plot with an empty label as the figure in:</p>
  
  <p><a href="http://tinypic.com/view.php?pic=4jnm83&amp;s=5#.Uqd-05GP-gQ" rel="nofollow noreferrer">http://tinypic.com/view.php?pic=4jnm83&amp;s=5#.Uqd-05GP-gQ</a>. </p>
  
  <p>More specifically, I get the error:</p>
  
  <pre><code>/usr/lib/pymodules/python2.7/matplotlib/legend.py:610: UserWarning: Legend does not support &lt;mpl_toolkits.mplot3d.art3d.Patch3DCollection object at 0x3bf46d0&gt;
  Use proxy artist instead."
  </code></pre>
  
  <p>Please find below an example demo of what I have tried so far: </p>
  
  <pre><code>import matplotlib.pyplot as plt
  from mpl_toolkits.mplot3d import Axes3D
  import random
  import csv
  from os import listdir
  from os.path import isfile, join
  
  fig = plt.figure()
  ax = fig.add_subplot(111, projection='3d')
  
  handles = []
  colors = ['blue', 'red']
  
  X1 = range(0,10)
  Y1 = range(0,10)
  Z1 = range(0,10)
  
  random.shuffle(X1)
  random.shuffle(Y1)
  random.shuffle(Z1)
  
  scatter1 = ax.scatter(X1, Y1, Z1, c = colors[0], marker = 'o')
  
  random.shuffle(X1)
  random.shuffle(Y1)
  random.shuffle(Z1)
  
  scatter2 = ax.scatter(X1, Y1, Z1, c = colors[1], marker = 'v')
  
  ax.set_xlabel('X', fontsize = 10)
  ax.set_ylabel('Y', fontsize = 10)
  ax.set_zlabel('Z', fontsize = 10)
  
  ax.legend([scatter1, scatter2], ['label1', 'label2'])
  
  plt.show()
  </code></pre>
  
  <p>I have seen other roughly similar examples but none of them uses the scatter() plot. Apart from a working solution, can someone explain what am I doing wrong?</p>