Home>

I am a python beginner.
I visualized the heat map with seaborn matplotlib with the following code, but it seems that only half of the upper and lower squares are displayed.
What instructions are necessary for the mass to fit?

import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
df = pd.read_excel ('Example', sheet_name = 'Dataset')
#Calculate correlation coefficient
corr = df [['WD', 'Hs', 'Hs2', 'Tp', 'Fcv', 'Fcd', 'Fwv', 'Fwd']]. corr ()
#Correlation coefficient converted to heat map
plt.figure (figsize = (11,11))
sns.heatmap (corr, annot = True)
plt.show ()

  • Answer # 1

    I think you should set the y range withplt.ylim ()

    # Correlation coefficient is heat mapped
    plt.figure (figsize = (11,11))
    sns.heatmap (corr, annot = True)
    plt.ylim (0, corr.shape [0])
    plt.show ()

Related articles