cartopy:放大到某个区域

时间:2017-06-07 12:18:57

标签: python gis cartopy

我想使用Cartopy只绘制一个区域(在我的例子中,北美和南美)。

我目前正在使用以下代码:

import cartopy
import cartopy.crs as ccrs
import matplotlib.pyplot as plt

lon, lat, freq = .., ..., ...  # initialize longitude and latitude and line width
ax = plt.axes(projection=ccrs.PlateCarree())
ax.stock_img()
ax.add_feature(cartopy.feature.LAND)
ax.add_feature(cartopy.feature.OCEAN)
ax.add_feature(cartopy.feature.COASTLINE)
ax.add_feature(cartopy.feature.BORDERS, linestyle='-', alpha=.5)

for la, lo, fq in zip(lat, lon, freq):
    plt.plot(lo, la, color='red', linewidth=fq, marker='o', transform=ccrs.PlateCarree())

然后它产生:

enter image description here

我想要的(放大版本):

enter image description here

有没有这样做?

1 个答案:

答案 0 :(得分:3)

您可以使用ax.set_extent()

ax.set_extent([-150, -20, -90, 90])
相关问题