title: matplotlib: how to put picture to a specific point of data-coordinate system
body: <p>I'm trying to add picture at the plot in specific place in it by a given coordinates in data-coordinate system. However it runs a little bit unpredicted. Here is a code snippet I wrote:</p>
  <pre><code>import matplotlib.pyplot as plt
  import numpy as np
  
  fig, ax = plt.subplots(figsize=(5,5))
  
  ax.set_xlim(0, 1)
  ax.set_ylim(0, 1)
  ax.grid('on')
  
  x = np.arange(0, 1, 0.005)
  y = np.exp(-x/2.) * np.sin(2*np.pi*x)
  ax.plot(x, y)
  
  im_orange = plt.imread('./test100x100_orange.png')
  im_blue = plt.imread('./test100x100_blue.png')
  
  x0, y0 = ax.transData.transform((0,0))
  print('transData(0,0) = {}'.format(ax.transData.transform((0,0))))
  
  ax.figure.figimage(im_orange, alpha=0.5)
  ax.figure.figimage(im_blue, x0, y0, alpha=0.5)
  </code></pre>
  <p><code>ax.transData.transform((0,0))</code> returns <code>transData(0,0) = [45. 45.]</code> which is unexpected since doesn't represent actual position of (0,0) on the plot. Here is result image as well:</p>
  <p><a href="https://i.stack.imgur.com/4OhGV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4OhGV.png" alt="figimage strange behaviour" /></a></p>
  <p>My base question is how to put picture left bottom corner exactly at (0,0) point in data-coordinates? And if possible please explain such behaviour of matplotlib.</p>
  <p><strong>Update.</strong> A few experiments on top. I've run a slightly modified script (provided below by Iammuratc but with <code>plt.savefig()</code> instead) in 3 modes:</p>
  <ol>
  <li><strong>From python console</strong> (copy and paste):
  <a href="https://i.stack.imgur.com/YfCn4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YfCn4.png" alt="enter image description here" /></a></li>
  <li><strong>Python script</strong> (something like <code>python test.py</code>:
  Result is the same as before.
  <a href="https://i.stack.imgur.com/nk9DD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nk9DD.png" alt="enter image description here" /></a></li>
  <li><strong>ipython</strong> from Jupiter Notebook:
  Suboption A: <code>plt.show()</code>
  <a href="https://i.stack.imgur.com/ZwtX1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZwtX1.png" alt="enter image description here" /></a></li>
  </ol>
  <p>Suboption B: <code>plt.savefig()</code></p>
  <p><a href="https://i.stack.imgur.com/xzkKi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xzkKi.png" alt="enter image description here" /></a></p>
  <p>Now it's even more confusing..</p>