[Python] How to add Vertical Line into Seaborn Heatmap

Discussão em 'Python' iniciado por Stack, Maio 20, 2025.

  1. Stack

    Stack Membro Participativo

    How to add vertical lines into searborn heatmap. I did the following way and no lines showed up. No error though. I am wondering if the lines are covered by heatmap color? any suggestions? Thanks

    fig,ax=plt.subplots(1,1,figsize=(30,15))
    g=sns.heatmap(df,cmap='coolwarm', robust=robust_colorbarrange,yticklabels=yticklabels,xticklabels=xticklabels,annot=False, \
    cbar_kws={'fraction':0.02, "shrink": 1.0,'pad':0.01},vmin=colorbar_min, vmax=colorbar_max, ax=ax)


    for datestr in CycleDates:
    date=datetime.strptime(datestr,'%Y-%m-%d %H:%M')
    ax.axvline(date,color='k',linestyle='-')

    Continue reading...

Compartilhe esta Página