title: Contour plot of image gives: TypeError Input must be 2D array error
body: <p>I am using Debian Linux and python 2.7.<br>
  I am reading an image and trying to process it but I am being shown the following error. Can someone please tell me what i'm doing wrong?</p>
  
  <pre><code>import Image
  import scipy
  from scipy import ndimage
  import matplotlib.pyplot as plt
  import numpy as np
  from scipy import misc
  import scipy.misc
  
  img = scipy.misc.imread("/home/subhradeep/Desktop/test.jpg")
  array=np.asarray(img)
  plt.figure(figsize=(10, 3.6))
  
  plt.subplot(131)
  plt.imshow(array, cmap=plt.cm.gray)
  
  plt.subplot(132)
  plt.imshow(array, cmap=plt.cm.gray, vmin=10, vmax=100)
  plt.axis('off')
  
  plt.subplot(133)
  plt.imshow(array, cmap=plt.cm.gray)
  plt.contour(array, [160, 211])
  plt.axis('off')
  
  plt.subplots_adjust(wspace=0, hspace=0., top=0.99, bottom=0.01, left=0.05,right=0.99)
  plt.show()
  </code></pre>
  
  <p>I get the following error message</p>
  
  <pre><code>Traceback (most recent call last):
    File "1saveimg.py", line 22, in &lt;module&gt;
      plt.contour(array, [160, 211])
    File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 2632, in contour
      ret = ax.contour(*args, **kwargs)
    File "/usr/lib/pymodules/python2.7/matplotlib/axes.py", line 7976, in contour
      return mcontour.QuadContourSet(self, *args, **kwargs)
    File "/usr/lib/pymodules/python2.7/matplotlib/contour.py", line 1414, in __init__
      ContourSet.__init__(self, ax, *args, **kwargs)
    File "/usr/lib/pymodules/python2.7/matplotlib/contour.py", line 860, in __init__
      self._process_args(*args, **kwargs)
    File "/usr/lib/pymodules/python2.7/matplotlib/contour.py", line 1427, in _process_args
      x, y, z = self._contour_args(args, kwargs)
    File "/usr/lib/pymodules/python2.7/matplotlib/contour.py", line 1488, in _contour_args
      x, y = self._initialize_x_y(z)
    File "/usr/lib/pymodules/python2.7/matplotlib/contour.py", line 1573, in _initialize_x_y
      raise TypeError("Input must be a 2D array.")
  TypeError: Input must be a 2D array.
  </code></pre>
  
  <p>I also tried <code>Image.open()</code> but that too throws the same error.</p>