我寫了一些代碼來創建一個光柵對象的png(self [:] =一個np數組)。 它應該是一種方法,很容易做一個陰謀 代碼的問題是,它運行良好的第一次, 但是當我多次運行此方法我得到一個圖片與多個傳說。從plot中刪除顏色條(python)
我試圖擺脫它與delaxes,但這個傳說是真是固執。
任何想法是如何解決這個歡迎
下面的代碼:
def plot(self,image_out,dpi=150, rotate = 60):
xur = self.xur()
xll = self.xll()
yur = self.yur()
yll = self.yll()
fig = plt.figure()
#tmp = range(len(fig.axes))
#tmp = tmp[::-1]
#for x in tmp:
# fig.delaxes(fig.axes[x])
ax = fig.add_subplot(111)
cax = ax.imshow(self[:],cmap='jet', extent = [yll,yur,xll,xur],
interpolation = 'nearest')
cbar = fig.colorbar()
plt.xticks(rotation=70)
plt.tight_layout(pad = 0.25)
plt.savefig(image_out,dpi=dpi)
return
問題解決了嗎? – mauve
對不起,我已經嘗試過,沒有成功 – user1507422