title: Adding legend to a surface plot
body: <p>I am trying to add legend to a surface plot but unable to do so. Here is the code.</p>
  
  <pre><code>import numpy as np
  from mpl_toolkits.mplot3d import Axes3D
  import matplotlib.pyplot as plt
  import random
  
  def fun(x, y):
    return 0.063*x**2 + 0.0628*x*y - 0.15015876*x + 96.1659*y**2 - 74.05284306*y  +      14.319143466051
  
  
  fig = plt.figure()
  ax = fig.add_subplot(111, projection='3d')
  x = y = np.arange(-1.0, 1.0, 0.05)
  X, Y = np.meshgrid(x, y)
  zs = np.array([fun(x,y) for x,y in zip(np.ravel(X), np.ravel(Y))])
  Z = zs.reshape(X.shape)
  
  ax.plot_surface(X, Y, Z)
  
  ax.set_xlabel('X')
  ax.set_ylabel('Y')
  ax.set_zlabel('Z')
  plt.plot(color='red',label='Lyapunov function on XY plane',linewidth=4)  # Adding legend
  
  plt.show()
  </code></pre>
  
  <p>Kindly help. Thanks in advance.</p>