Skip to content Skip to sidebar Skip to footer

Missing Labels In Matplotlib Correlation Heatmap

I'm playing around with the abalone dataset from UCI's machine learning repository. I want to display a correlation heatmap using matplotlib and imshow. The first time I tried it,

Solution 1:

To get your labels back, you can force matplotlib to use enough xticks so that all your labels can be shown. This can be done by adding

ax1.set_xticks(np.arange(len(labels)))
ax1.set_yticks(np.arange(len(labels)))

before your statements ax1.set_xticklabels(labels,rotation=90, fontsize=10) and ax1.set_yticklabels(labels,fontsize=10).

This results in the following plot:

enter image description here

Post a Comment for "Missing Labels In Matplotlib Correlation Heatmap"