Hi,
I'm new to matplotlib and I'm looking for an easy way to plot geographical
data on a background map: bkgmap.png
http://old.nabble.com/file/p29679002/bkgmap.png 
So far I only found out about warpimage() to do this but only part of
bkgmap.png comes up in the output image.  I think this is because this image
has no pixels covering all the world.
http://old.nabble.com/file/p29679002/partialbkg_polygon.png 

Any idea on how to insert this image as background? 
THANKS

Code: the polygon displays in right position even though background doesn't
show OK (tested with map,lat/lon lines drawn too) 

import sys
import Image, ImageDraw  # PIL
from matplotlib.patches import Polygon
from mpl_toolkits.basemap import Basemap
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
import numpy as np
 
lat0=48
lon0=13
lllon=-15
lllat=20
urlon=73
urlat=57
map =
Basemap(projection='stere',lat_0=lat0,lon_0=lon0,llcrnrlon=lllon,llcrnrlat=lllat,urcrnrlon=urlon,urcrnrlat=urlat,
              resolution='c',area_thresh=1000.)
map.warpimage(image='bkgmap.png',scale=None,ax=plt.gca())
# points
lat = [50.,55.,45.,40.,50.]
lon = [-20.,-10.,10.,-10.,-20.]
x0,y0 = map(lon[0],lat[0])   
x1,y1 = map(lon[1],lat[1])   
x2,y2 = map(lon[2],lat[2])   
x3,y3 = map(lon[3],lat[3])   
x4,y4 = map(lon[4],lat[4])   
plt.gca().add_patch(Polygon([(x0,y0),(x1,y1),(x2,y2),(x3,y3),(x4,y4)],fill=1,facecolor='red',edgecolor='black'))
plt.show()
-- 
View this message in context: 
http://old.nabble.com/matplotlib-basemap-plot-geo-data-on-background-map-tp29679002p29679002.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to