title: Python Matplotlib Basemap overlay small image on map plot
body: <p>I am plotting data from an aircraft on a map and I would like to insert this 75px by 29px PNG image of an airplane at the coordinates of the latest data point on the plot.</p>
  <p><a href="https://i.stack.imgur.com/Q5tbO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Q5tbO.png" alt="airplane" /></a></p>
  
  <p>As far as I know and have read, <code>pyplot.imshow()</code> is the best way to accomplish this. However, I am getting hung up on step 1, getting the image to even display. Using a normal plot instead of Basemap, it is easy enough to get the image to appear using imshow, but when using Basemap, I can't get it to show up at all. See the example code.</p>
  <p>If I can get the image to display on the map, I am assuming that I can, by trial and error, set its position and some proper dimensions for it using the <code>extent</code> attribute of <code>imshow()</code>, with the plot coordinates converted from the map coordinates <code>x,y = m(lons,lats)</code>.</p>
  <p>Here is the example code (to try it you may want to download the airplane image above).</p>
  <pre><code>from matplotlib import pyplot as plt
  from mpl_toolkits.basemap import Basemap
  import Image
  from numpy import arange
  
  lats = arange(26,29,0.5)
  lons = arange(-90,-87,0.5)
  
  m = Basemap(projection='cyl',llcrnrlon=min(lons)-2,llcrnrlat=min(lats)-2,
              urcrnrlon=max(lons)+2,urcrnrlat=max(lats)+2,resolution='i')
  
  x,y = m(lons,lats)
  u,v, = arange(0,51,10),arange(0,51,10)
  barbs = m.barbs(x,y,u,v)
  m.drawcoastlines(); m.drawcountries(); m.drawstates()
  
  img = Image.open('c130j_75px.png')
  im = plt.imshow(img, extent=(x[-1],x[-1]+50000,y[-1],y[-1]+50000))
  plt.show()
  </code></pre>
  <p>Here's the resulting image, which doesn't contain a trace of the airplane. I have tried several different sizes using <code>extent</code>, thinking I may have just made it too small, but with no success. I also tried setting <code>zorder=10</code>, but also with no luck. Any help would be appreciated.</p>
  <p><a href="https://i.stack.imgur.com/cuDNs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cuDNs.png" alt="result" /></a></p>
  
  <p>Update: I can now get the image to at least appear by using <code>m.imshow</code> instead of <code>plt.imshow</code>, since the former passes in the map's axes instance, but the <code>extent</code> argument seems to have no effect on the dimensions of the image, as it always fills up the entire plot no matter how small I make <code>extent</code> dimensions, even if I set them to zero. How can I scale the airplane image appropriately and position it near the last data point?</p>
  <p><code>im = m.imshow(img, extent=(x[-1],x[-1]+5,y[-1],y[-1]+2))</code></p>
  <p><a href="https://i.stack.imgur.com/G9K3b.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/G9K3b.png" alt="result2" /></a></p>