Search code examples
pandasseabornheatmapcorrelation

Symbols accross the top


I would like the symbols accross the top, not the bottom. Can't find docs on how to do this?

fig, x = plt.subplots(figsize=(width, height))
x = seaborn.heatmap(corr_df, annot=True, cmap='RdYlGn')
st.pyplot(fig)

Solution

  • IIUC, you are looking for xaxis.tick_top:

    import seaborn as sns
    import matplotlib.pyplot as plt
    
    glue = sns.load_dataset("glue").pivot("Model", "Task", "Score")
    ax = sns.heatmap(glue)
    ax.invert_yaxis()
    ax.xaxis.tick_top()
    plt.show()
    

    Output:

    enter image description here