0

I am plotting a correlation heatmap as follows:

plt.figure(figsize = (20,8))
sns.heatmap(df.corr(),annot=True, cmap = 'coolwarm')

and it is showing a plot as follows:

enter image description here

As it can be seen that the heatmap is not neatly made on the edges with the names and the values overlapping. Is there a way I can neaten it up to get a heatmap as follows:

enter image description here

Thanks

some_programmer
  • 3,268
  • 4
  • 24
  • 59

1 Answers1

0

The following works fine for me

fig, ax = plt.subplots(figsize=(20, 8))
corr = df.corr()
sns.heatmap(corr, 
            xticklabels=corr.columns.values,
            yticklabels=corr.columns.values,
               annot=True)
plt.show()
rasthiya
  • 650
  • 1
  • 6
  • 20