1

How should i do to show the axes value(dataframe's columns name) vertically? following is my code, it will display the columns' name horizontally as fig shows.

import csv
import pandas as pd
import matplotlib.pylab as plt
import seaborn as sns

adress='D:\\data\\ltl_credit_model_30.csv'
df=pd.read_csv(adress,sep=',')
corr=df.corr()

#Generate a mask for the upper triangle
mask = np.zeros_like(corr, dtype=np.bool)
mask[np.triu_indices_from(mask)] = True
f, ax = plt.subplots(figsize=(20, 20))

# Generate a custom diverging colormap
cmap = sns.diverging_palette(220, 100,as_cmap=True)

# Draw the heatmap with the mask and correct aspect ratio
sns.heatmap(corr, mask=mask, cmap=cmap, vmax=1,linewidths=.5,
        cbar_kws={"shrink": .6},annot=True,annot_kws={"size":8} )
plt.show()

Resulting figure: Graph

jotasi
  • 5,077
  • 2
  • 29
  • 51

0 Answers0