【发布时间】:2018-05-13 00:16:13
【问题描述】:
使用cartopy时如何改变图形的宽高。 figsize 仅更改图形周围的空白区域,而不更改图形本身。有任何想法吗。
import cartopy.crs as ccrs
import cartopy.feature as cfeature
import matplotlib.pyplot as plt
def main():
fig = plt.figure(figsize=(10,10))
ax = fig.add_subplot(1, 1, 1, projection=ccrs.PlateCarree())
ax.set_extent([-20, 60, -40, 45], crs=ccrs.PlateCarree())
ax.add_feature(cfeature.LAND)
ax.add_feature(cfeature.OCEAN)
ax.add_feature(cfeature.COASTLINE)
ax.add_feature(cfeature.BORDERS, linestyle=':')
ax.add_feature(cfeature.LAKES, alpha=0.5)
ax.add_feature(cfeature.RIVERS)
plt.show()
if __name__ == '__main__':
main()
这个代码在here找到
【问题讨论】:
-
在 Cartopy 中执行几个步骤即可。但不是像 Basemap 这样的单一语句。
-
谢谢,知道怎么做吗?
-
您的问题已经改变。我上面的评论现在无效了。
标签: python python-3.x python-2.7 matplotlib cartopy