2017-04-22 95 views
1

我在python中製作了一些顏色貼圖。在他們之上我想要增加一些大陸輪廓,使用我運行的模型中提供的海陸面具。它由1或0,1組成,0組成無土地。 有一些奇怪的字符寫入等值線圖。這裏有沒有人知道我怎樣才能讓輪廓連接到自身,這樣就可以順利進行,而不會被每行之間的小奇怪字符打斷?顏色貼圖上的輪廓:不連續(Python)

這裏是數字看起來像什麼:enter image description here

這裏是一段代碼(注意這個地圖是含有其他地圖陰謀的一部分,所以這是指數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() 

回答

1

看來你已要求使用線

plt.clabel(CS, fontsize=3, inline=1) 

因此,如果您刪除線,輪廓標籤應該消失在你的那些情節等高線標籤(clabel)。

+0

完美的是很容易,複製粘貼以前的等高線圖代碼時不小心!謝謝! – JadeChee