title: Export Python Plot to KML
body: <p>How to create a lon/lat plot with Matplotlib that can be exported to Google Earth with points appearing on G.E. correctly.  Image can be seen here: <a href="https://imgur.com/4szLzNF" rel="nofollow noreferrer">http://imgur.com/4szLzNF</a>
  <a href="https://i.stack.imgur.com/MYw4a.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MYw4a.png" alt="Google Earth view"></a>
    Seems like there is always a slight border around my exported figure such that the points I define in plot are off in G.E.</p>
  
  <pre><code>x = [0, 10, 10, 0, 0]
  y = [10, 10, 0, 0, 10]
  x1=[0,1,2,3,4,5,6,7,8,9,10]
  
  fig = Figure(facecolor=None, frameon=False)
  ax = fig.add_axes([0,0,1,1])
  ax.axis('off')
  
  ppl.plot(x, y, 'r',  axes=ax)
  ppl.plot(x, y, '.b', axes=ax)
  ppl.plot(x1, x1, 'g', axes=ax)
  
  ppl.axis('off')
  ppl.tight_layout(0,h_pad=0, w_pad=0)
  border1 = ppl.axis(bbox_inches='tight')
  ppl.show()
  
  pngName = 'temp.png'
  py.savefig(pngName, bbox_inches='tight', pad_inches=0, transparent=True)
  
  bottomleft  = (border1[0],border1[2])
  bottomright = (border1[1],border1[2])
  topright    = (border1[1],border1[3])
  topleft     = (border1[0],border1[3])
  
  kml = simplekml.Kml()
  ground = kml.newgroundoverlay(name='GroundOverlay')
  ground.icon.href = pngName
  ground.gxlatlonquad.coords =[bottomleft, bottomright, topright, topleft]
  kml.save("GroundOverlay_temp.kml")
  </code></pre>