Python绘制南极投影(及散点热力图)

import matplotlib.pyplot as plt
import matplotlib.path as mpath
import matplotlib.ticker as mticker
import cartopy.crs as ccrs
import cartopy.feature as cfeature
from cartopy.mpl.gridliner import LONGITUDE_FORMATTER, LATITUDE_FORMATTER
import cartopy.mpl.ticker as cticker
import cartopy.io.shapereader as shpreader
import seaborn as sns
sns.set(style='whitegrid')
font = {
    
    'family' : 'Times New Roman',
        'color'  : 'black',
        'weight' : 'normal',
        'size'   : 25,
        }
fig1 = plt.figure(figsize=(18,14))

######################################################################整体投影图
leftlon, rightlon, lowerlat, upperlat = (-180,180,-60,-90)
img_extent = [leftlon, rightlon, lowerlat, upperlat]
#以下我仅展示了左半部分,右半部分基本一致,在此省略
f1_ax1 = fig1.add_axes([0.21, 0.26, 0.77, 0.51],projection = ccrs.SouthPolarStereo())
gl=f1_ax1.gridlines(crs=ccrs.PlateCarree(), draw_labels=True,
                  linewidth=1, color='gray', alpha=0.5, linestyle='--')
gl.ylocator = mticker.FixedLocator([-70, -80])
f1_ax1.set_extent(img_extent, ccrs.PlateCarree())
#通过圆柱投影的范围限制地图范围,这样设置地图参数较为方便
f1_ax1.add_feature(cfeature.COASTLINE.with_scale('50m'))

#######以下为网格线的参数######
theta = np.linspace(0, 2*np.pi, 100)
center, radius = [0.5, 0.5], 0.5
verts = np.vstack([np.sin(theta), np.cos(theta)]).T
circle = mpath.Path(verts * radius + center)

# ##############################
f1_ax1.set_boundary(circle, transform=f1_ax1.transAxes)
lon=info_dict['lon']
lat=info_dict['lat']
values=info_dict['cor']
c7 = f1_ax1.scatter(lon,lat,c=values,s=180, zorder=0,transform=ccrs.PlateCarree(), cmap=plt.cm.bwr)
cb=plt.colorbar(c7)
cb.ax.tick_params(labelsize=16)  #设置色标刻度字体大小。
f1_ax1.scatter(lon[pvalues_list<0.05],lat[pvalues_list<0.05],c='none',marker='o',linewidths=2,edgecolors='black',s=180, zorder=0,transform=ccrs.PlateCarree())


########################################################################################另外三幅子图
ax2 = fig1.add_subplot(3,3,1, projection=ccrs.PlateCarree(central_longitude = -60))
gl=ax2.gridlines(crs=ccrs.PlateCarree(), draw_labels=True,
                  linewidth=1, color='gray', alpha=0.5, linestyle='--')
gl.ylocator = mticker.FixedLocator([-65, -75])
gl.xlocator = mticker.FixedLocator([-85, -75,-65,-55])
ax2.add_feature(cfeature.COASTLINE.with_scale('110m'))
img_extent1=[-90,-50,-60,-85]
ax2.set_extent(img_extent1, ccrs.PlateCarree())
c7 = ax2.scatter(lon,lat,c=values,s=150, zorder=0,transform=ccrs.PlateCarree(), cmap=plt.cm.bwr)
ax2.scatter(lon[pvalues_list<0.05],lat[pvalues_list<0.05],c='none',marker='o',linewidths=2,edgecolors='black',s=180, zorder=0,transform=ccrs.PlateCarree())


ax2 = fig1.add_subplot(3,3,4, projection=ccrs.PlateCarree(central_longitude = 165))
gl=ax2.gridlines(crs=ccrs.PlateCarree(), draw_labels=True,
                  linewidth=1, color='gray', alpha=0.5, linestyle='--')
gl.ylocator = mticker.FixedLocator([-65, -75])
gl.xlocator = mticker.FixedLocator([145, 155,165,175])
ax2.add_feature(cfeature.COASTLINE.with_scale('110m'))
img_extent1=[140,180,-60,-85]
ax2.set_extent(img_extent1, ccrs.PlateCarree())
c7 = ax2.scatter(lon,lat,c=values,s=150, zorder=0,transform=ccrs.PlateCarree(), cmap=plt.cm.bwr)
ax2.scatter(lon[pvalues_list<0.05],lat[pvalues_list<0.05],c='none',marker='o',linewidths=2,edgecolors='black',s=180, zorder=0,transform=ccrs.PlateCarree())


ax2 = fig1.add_subplot(3,3,7, projection=ccrs.PlateCarree())
gl=ax2.gridlines(crs=ccrs.PlateCarree(), draw_labels=True,
                  linewidth=1, color='gray', alpha=0.5, linestyle='--')
gl.ylocator = mticker.FixedLocator([-65, -75])
gl.xlocator = mticker.FixedLocator([35, 45,55,65])
ax2.add_feature(cfeature.COASTLINE.with_scale('110m'))
img_extent1=[30,70,-60,-85]
ax2.set_extent(img_extent1, ccrs.PlateCarree())
c7 = ax2.scatter(lon,lat,c=values,s=150, zorder=0,transform=ccrs.PlateCarree(), cmap=plt.cm.bwr)
ax2.scatter(lon[pvalues_list<0.05],lat[pvalues_list<0.05],c='none',marker='o',linewidths=2,edgecolors='black',s=180, zorder=0,transform=ccrs.PlateCarree())


plt.savefig('Antarctic.jpg',dpi=300)

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_45577825/article/details/120293766
今日推荐