I am new to Matplotlib and I created a Heatmap of some number's correlation using the matshow
function. Currently the code below only displays every 5th label (or tick), and I want it to display all of it. The code:
names = list('ABCDEDFGHIJKLMNOPQRSTU')
#just some random data for reproductability
df = pd.DataFrame(np.random.randint(0,100,size=(100, 22)), columns=names)
fig = plt.figure()
ax = fig.add_subplot(111)
cor_matrix = df.corr()
#these two lines don't change the outcome
ax.set_xticks(np.arange(len(names)))
ax.set_yticks(list(range(0,len(names))))
ax.matshow(cor_matrix)
plt.show()
I read this question: How to display all label values in matplotlib? But the answer there didn't work for me. The figure doesn't change if I don't set the ticks explicitly, or set them either way.
Also tried this questions's solution: How to make matplotlib show all x coordinates?
Which was plt.xticks(list(range(0,len(names))))
, but that didn't do anything either.