title: Matplotlib rotate image file by X degrees
body: <p>How can I rotate an image file and plot it in matplotlib?</p>
  
  <p>I know I can open it using PIL and rotate it, but this seems way too much for this simple function, that I'm probably not finding.</p>
  
  <p>I found this piece of code around here, but doesn't seems to work:</p>
  
  <pre><code>from matplotlib import pyplot, image, transforms
  
  img = image.imread('filename.png')
  
  pyplot.ion()
  fig = pyplot.figure()
  ax = fig.add_subplot(111)
  
  for degree in range(360):
      pyplot.clf()
      tr = transforms.Affine2D().rotate_deg(degree)
  
      ax.imshow(img, transform=tr)
      fig.canvas.draw()
  </code></pre>