DataAnalysis.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:ModelFlow 作者: yuezPrincetechs 项目源码 文件源码
def heatmap(data,ax,xlabel=None,ylabel=None,xticklabels=None,yticklabels=None,title=None,fontsize=12):
    '''
    ??matplotlib.pyplot.pcolor?????
    ?????(pc,ax)???pc????matplotlib.pyplot.colorbar??????mappable?
    '''
    pc=ax.pcolor(data,cmap=plt.cm.Blues)
    if xlabel is not None:
        ax.set_xlabel(xlabel,fontsize=fontsize)
    if ylabel is not None:
        ax.set_ylabel(ylabel,fontsize=fontsize)
    ax.set_xticks(np.arange(data.shape[1])+0.5,minor=False)
    if xticklabels is not None:
        ax.set_xticklabels(xticklabels,minor=False,fontsize=fontsize)
    ax.set_yticks(np.arange(data.shape[0])+0.5,minor=False)
    if yticklabels is not None:
        ax.set_yticklabels(yticklabels,minor=False,fontsize=fontsize)
    if title is not None:
        ax.set_title(title,fontsize=fontsize)
    return pc,ax


#????X?Y????
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号