import netCDF4 as nc
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
import matplotlib.font_manager as fm
import plotly.express as px
import numpy.ma as ma
myfont = fm.FontProperties(fname='C:/Windows/Fonts/simkai.ttf')
file='E:/my_data/intergrate.nc'
dataset=nc.Dataset(file)
attribute=dataset.variables.keys()
print(attribute)
lon=dataset.variables['longitude']
lat=dataset.variables['latitude']
lev=dataset.variables['lev']#深度
time=dataset.variables['time']
ts=dataset.variables['ts']#海温
sst0=ts[:,0,:,:]#海表温度
sst=ma.masked_where(sst0>50,sst0)#将过高的值屏蔽
year_mean_sst=np.mean(sst[:,:,:],axis=0)#年平均海表温
def format(value,title):
map = Basemap(lon_0=180,lat_0=0)#lon_0中心位置参数
map.drawcoastlines()#绘制海岸线
x,y = np.meshgrid(lon,lat)
cs=map.contourf(x,y,value,cmap = plt.cm.RdBu_r)
cbar=map.colorbar()
plt.title(title,fontsize=20,fontproperties=myfont)
# 添加经纬线
map.drawparallels(circles=np.linspace(-90, 90, 7),
labels=[1, 0, 0, 0], color='gray')
map.drawmeridians(meridians=np.linspace(-180, 180, 13),
labels=[0, 0, 0, 1], color='gray')
plt.axhline(y=140,c='r',ls='--',lw=5)
fig1 = plt.figure(figsize=(10,8),dpi=150)
format(year_mean_sst,'年平均海表温度分布')
plt.show()
上面是我写的代码,下面是画出来的图
请问要怎么画出下面这种,能显示更多细节,分辨率更高的图呢??