1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
| ref_lat = 32 ref_lon = 98 true_lat1 = 30 true_lat2 = 60 false_easting = (180-1)/2*30000 false_northing = (99.5-1)/2*30000
proj_lambert = ccrs.LambertConformal( central_longitude=ref_lon, central_latitude=ref_lat, standard_parallels=(true_lat1,true_lat2), cutoff=-30, false_easting=false_easting, false_northing=false_northing, )
def ax_set(ax): ax.set_extent([0, false_easting*2, 0, false_northing*2], crs=proj_lambert) ax.coastlines(linewidth=0.8,resolution='50m',zorder=101) ax.add_feature(cfeature.LAKES.with_scale('50m'),linewidth=0.5,edgecolor='black',facecolor='none')
filepath =disk+':\LHwork\shpfile\中国GIS地图\国家基础地理数据/hyd1_4l.shp' crs = ccrs.PlateCarree() reader = shpreader.Reader(filepath) geoms = reader.geometries() ax.add_geometries(geoms, crs, lw=0.5, fc='none') reader.close()
gl=ax.gridlines(draw_labels=True,linestyle=":",linewidth=0.6 ,x_inline=False, y_inline=False,color='k',zorder=102)
gl.top_labels=False import matplotlib.ticker as mticker gl.right_labels=False gl.xformatter = LONGITUDE_FORMATTER gl.yformatter = LATITUDE_FORMATTER
gl.xlocator=mticker.FixedLocator(np.arange(60,160,10)) gl.ylocator=mticker.FixedLocator(np.arange(10,60,10)) gl.rotate_labels = False gl.xlabel_style={'size':8,} gl.ylabel_style={'size':8,} ax.spines['geo'].set_linewidth(0.6)
plt.plot([110,122], [28,28], 'r--',linewidth=1,transform=ccrs.PlateCarree(),zorder=105) plt.plot([110,122], [32,32], 'r--',linewidth=1,transform=ccrs.PlateCarree(),zorder=105) plt.plot([110,110], [28,32], 'r--',linewidth=1,transform=ccrs.PlateCarree(),zorder=105) plt.plot([122,122], [28,32], 'r--',linewidth=1,transform=ccrs.PlateCarree(),zorder=105)
|