corrmat is correlation dataframe with 37 columns and 37 rows
Code:
f, ax = plt.subplots(figsize=(30,25))
sns.heatmap(corrmat,vmax=0.8,square=True)
I am not able to change the rotation of labels and it is creating mess as no. of variables used for correlation matrix is more in number.
Let me know how to make below heatmap more readable
Seaborn is built on top of the matplotlib library. So, to rotate labels, you'll need to access the axis object and rotate it.
Something like this might work:
for tick in ax.get_xticklabels():
tick.set_rotation(45)
You can similarly rotate y-axis labels and calibrate the rotation angles using the number.
If you have also done an import matplotlib.pyplot
like this:
import matplotlib.pyplot as plt
You can specify the following code after you create the heatmap to set the degree of label rotation of both y and x axis.
plt.yticks(rotation= 0)
plt.xticks(rotation=90)
You can play around with the exact number of rotation until you are happy with how it looks.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.