python中Cartopy 绘制地图坐标的label代码示例
时间: 2023-06-03 21:07:42 浏览: 248
以下是一个简单的示例代码:
```
import cartopy.crs as ccrs
import cartopy.feature as cfeature
import matplotlib.pyplot as plt
fig = plt.figure(figsize=(12, 8))
ax = fig.add_subplot(1, 1, 1, projection=ccrs.PlateCarree())
ax.add_feature(cfeature.LAND)
ax.add_feature(cfeature.COASTLINE)
ax.set_extent([-180, 180, -90, 90], crs=ccrs.PlateCarree())
ax.gridlines()
ax.text(-175, -80, 'South America', transform=ccrs.PlateCarree())
ax.text(-140, 45, 'North America', transform=ccrs.PlateCarree())
ax.text(30, 50, 'Europe', transform=ccrs.PlateCarree())
ax.text(120, 50, 'Asia', transform=ccrs.PlateCarree())
ax.text(140, -20, 'Australia', transform=ccrs.PlateCarree())
ax.text(10, -30, 'Africa', transform=ccrs.PlateCarree())
plt.show()
```
这段代码使用 Cartopy 模块绘制了一个世界地图,并添加了坐标轴 label。在这个例子中,使用 `ax.text()` 方法添加了各个洲和区域的名字。注意要使用 `transform=ccrs.PlateCarree()` 参数来指定坐标系。
阅读全文
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)