Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python: stretch world map

I'm trying to plot some coordinate points on a world map. I use a cylindrical projection as follows:

fig = plt.figure(figsize=(18,6))
map = Basemap(projection='cyl', lat_0 = 57, lon_0 = -135, resolution = 'c', area_thresh = 0.1, llcrnrlon=-180.0, llcrnrlat=-7.0, urcrnrlon=180.0, urcrnrlat=7.0)
X, Y = map(LON, LAT)
map.plot(X, Y, "ro", markersize=5)

The problem is that my points (about 1000) are all included in a [-3°:-3°] latitude range and they get all squeezed into a tight line near the equator, once plotted in a whole world map.

Hence, I'd like to "stretch" the, let's say, [-5°:+5°] latitude range, even losing the proportionality of my projection, in order to zoom the region of interest and widen the distance among my points. I tried limiting the llcrnrlat and urcrnrlat parameters, but that just cropped the region of interest, without zooming or enlarging the image. How can I do this?

Points are all compressed

like image 677
urgeo Avatar asked Jan 29 '16 09:01

urgeo


1 Answers

If you don't care about losing the proportionally you can pass to the basemap the fix_aspect parameter (that is True by default)

map = Basemap(projection='cyl', lat_0 = 57, lon_0 = -135, resolution = 'c', area_thresh = 0.1, llcrnrlon=-180.0, llcrnrlat=-7.0, urcrnrlon=180.0, urcrnrlat=7.0, fix_aspect=False)
like image 116
Francisco Puga Avatar answered Oct 09 '22 09:10

Francisco Puga