title: Rotate an image in matplotlib?
body: <p>I want to rotate an image generated by <code>plt.imshow()</code>. Is that possible somehow? I don't want to rotate (with <code>scipy.ndimage.rotate</code> for example) the underlying array I use for plotting, because it always introduces artifacts, and they are affecting what I'm looking at in the image. Also would be better for me to have pixels rotated by 45 degrees.</p>
  
  <p>I've found <a href="https://stackoverflow.com/a/23790983/1304161" title="How can I rotate a matplotlib plot through 90 degrees?">this</a>, where it's suggested to use use the scipy rotate method on the figure. But it doesn't work for me. This is the relevant code: </p>
  
  <pre><code>im = plt.imshow(np.log2(data+1), origin='lower', interpolation='none', cmap=WhRd,
                          extent=[0, (end-start)*200000, 0, 50*200000])
  im_rot = ndimage.rotate(im, 45)
  </code></pre>
  
  <p>And this is the error, pointing at the second line:</p>
  
  <pre><code>/usr/local/lib/python2.7/dist-packages/scipy/ndimage/interpolation.pyc in rotate(input, angle, axes, reshape, output, order, mode, cval, prefilter)
      631         axes[1] += rank
      632     if axes[0] &lt; 0 or axes[1] &lt; 0 or axes[0] &gt; rank or axes[1] &gt; rank:
  --&gt; 633         raise RuntimeError('invalid rotation plane specified')
      634     if axes[0] &gt; axes[1]:
      635         axes = axes[1], axes[0]
  
  RuntimeError: invalid rotation plane specified
  </code></pre>
  
  <p>Is there any way to achieve what I want?</p>