0
我想用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())
然後它產生:
我想要什麼(放大版本):
有沒有辦法做到這一點?
這是很好的做法,包括設定的範圍內時,因此,如果投影改變了代碼仍然可以工作,但在這個例子中,結果將是一個'crs'相同:'ax.set_extent([ - 150,-20,-90,90],crs = ccrs.PlateCarree())' – ajdawson