1
$\begingroup$

I would like to have correlation matrix like this one, but with only 3 bottom rows but all the columns. How can I generate it?

enter image description here

corr = corrdata.corr()
sns.heatmap(corr, mask=np.zeros_like(corr), annot=True, cmap=sns.diverging_palette(220, 10, as_cmap=True),
            square=True, ax=ax, fmt='.2f' ,  )
$\endgroup$
0
$\begingroup$

You can use a slice of the correlation matrix dataframe.

import pandas as pd
import seaborn as sns

df = pd.DataFrame({'A':[0,1,2,3,],'B':[4,5,6,7],'C':[8,9,10,11]})
sns.heatmap(df.iloc[2:3, 1:3], annot=True, cmap=sns.diverging_palette(220, 10, as_cmap=True),square=True, )
$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.