matplotlib去掉坐标轴刻度

时间:2021-09-25 05:58:03
#! usr/bin/python
#coding=utf-8 
import numpy as np
import matplotlib.pyplot as plt 
data=np.random.rand(10,10)
fig, ax=plt.subplots()
data[data==-1]=np.nan#去掉缺省值-1
im =ax.imshow(data,interpolation='none',cmap='Reds_r',vmin=0.6,vmax=.9)#不插值
ax.set_xticks([])
ax.set_yticks([])

########################################################################
fig.savefig('te.png')