I tested the same plot with a background image in Mercator with same results and I also tested with Mercator covering almost the entire world with the same results. Only a little portion of the background image shows as background although the polygon looks OK in all cases (with maps drawn and with either background image). Unfortunately, I must use the provided background images for my project. I may need to look for some other tool to accomplish drawing curves on a provided background image instead of relying on matplotlib. I did not understand the need for me to write my own transformation functions. I only used lat/lon->x/y for the points in the curve and the polygon shows up OK. What should I write my own transformations for? THANKS
izzybitsie wrote: > > Thanks for your answer. I'm actually looking to plot filled curves whose > points are lat/lon points on top of a given background map. The problem > experienced is misrepresentation of background map when I insert it using > warpimage(), the only function to do this I found so far. > > > Aman Thakral wrote: >> >> If you're just looking for points, you can use ax.scatter(). It will >> plot >> the points. Also, make sure you set the zorder keyword argument in the >> scatter. >> >> Example: >> x=range(10) >> y=range(10) >> z=range(10,20) >> ax.scatter(x,y,c=z,zorder=10) >> >> Hope this helps, >> Aman >> >> On Fri, Sep 10, 2010 at 1:06 PM, izzybitsie <isid...@juno.com> wrote: >> >>> >>> 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 >>> >> >> >> >> -- >> Aman Thakral >> B.Eng & Biosci, M.Eng Design >> >> ------------------------------------------------------------------------------ >> 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 >> >> > > -- View this message in context: http://old.nabble.com/matplotlib-basemap-plot-geo-data-on-background-map-tp29679002p29679934.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