- 积分
- 5401
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2020-12-28
- 最后登录
- 1970-1-1
|
发表于 2023-2-18 15:06:43
|
显示全部楼层
不知道这样是不是你想要的:
- from cartopy.mpl.ticker import LongitudeFormatter,LatitudeFormatter
- import cartopy.crs as ccrs
- import matplotlib.pyplot as plt
- import numpy as np
- proj = ccrs.PlateCarree()
- fig, axes = plt.subplots(4, 4, sharex=True, sharey=True, figsize=(6,6),dpi=200,
- subplot_kw={'projection':proj})
- fig.tight_layout()
- for i, row in enumerate(axes):
- for j, col in enumerate(row):
-
-
- axes[i,j].coastlines('50m')
- # set_xytick(axes[i,j])
- box = [0,6,15,20]
- xstep,ystep = 3,2
- axes[i,j].set_extent(box,crs=ccrs.PlateCarree())
-
- axes[-1,j].set_xticks(np.arange(box[0],box[1]+xstep, xstep),crs=ccrs.PlateCarree())
- axes[i,0].set_yticks(np.arange(box[2], box[3]+1, ystep),crs=ccrs.PlateCarree())
- lon_formatter = LongitudeFormatter(zero_direction_label=False)#True/False
- lat_formatter = LatitudeFormatter()
- axes[-1,j].xaxis.set_major_formatter(lon_formatter)
- axes[i,0].yaxis.set_major_formatter(lat_formatter)
- plt.tight_layout()
- plt.delaxes(axes[3,2])
- plt.delaxes(axes[3,3])
- plt.show()
复制代码 |
评分
-
查看全部评分
|