title: "Invalid dimensions for image data" error when creating a density plot of a function
body: <p>I keep receiving:</p>
  
  <blockquote>
    <p>TypeError: Invalid dimensions for image data</p>
  </blockquote>
  
  <p>with a blank graph that has axis going from 0.0 to 1.0 on both sides</p>
  
  <pre><code>import numpy as np  
  import matplotlib.pyplot as plt  
  from numpy import sin,cos,sqrt,arctan2  
  from pylab import plot,show,xlabel,ylabel,linspace,ylim  
  
  D = 50
  
  x = linspace(0,D,1000)  
  y = linspace(0,D,1000)
  
  r1 = sqrt((x**2)+(y*2)) 
  
  def function1():  
      f1 = sin(r1)  
      return f1  
  
  function1()
  
  plt.imshow(r1,origin='lower',extent=[0,10,0,5])  
  plt.colorbar()  
  plt.show()
  </code></pre>