彩色地图上的轮廓:不连续 (Python)

Contour on color map: not continuous (Python)

我在python做了一些彩图。在它们之上,我想添加一些大陆等高线,使用模型 I 运行 中提供的海陆遮罩。它仅由 1 或 0 组成,1 表示土地,0 表示无土地。 等高线图中写入了一些奇怪的字符。这里有谁知道我怎样才能让轮廓连接到自身,这样轮廓就平滑了,而不是被每行两端之间的那些奇怪的小字符破坏了?

下图是这样的:

这是一段代码(注意这张地图是包含其他地图的地块的一部分,所以这是索引 9 的地图)。

lsmfile = netcdf.netcdf_file("/Volumes/LaCie/Plasim/Earth2/high/1367/SOL1367earth050.nc","r")
lat = lsmfile.variables["lat"].data
lon = lsmfile.variables["lon"].data
mask = lsmfile.variables["lsm"].data
mask = mask[0]
cmap = plt.get_cmap('bwr')

fig, ax = plt.subplots(nrows=5,ncols=2,figsize=(16,14))
im9 = ax.flat[9].pcolormesh(lon, lat, surfalbearth, cmap=cmap,norm=norm)
fig.colorbar(im9, ax=ax.flat[9])
ax.flat[9].set_xlim(xmin=0, xmax=355)
ax.flat[9].set_ylim(ymin=-86, ymax=86)
CS = plt.contour(lon,lat,mask, 1,colors='k')
plt.clabel(CS, fontsize=3, inline=1)

fig.tight_layout() 
plt.savefig('Maps')
plt.show()

您似乎已经要求使用线

在您的绘图中添加这些等高线标签 (clabel)
plt.clabel(CS, fontsize=3, inline=1)

因此,如果您删除该线,等高线标签应该会消失。