python: stretch world map
Asked Answered
P

1

6

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

Presumptive answered 29/1, 2016 at 9:47 Comment(0)
G
1

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)
Greensand answered 3/12, 2016 at 19:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.