I have a numpy matrix fooarray
of size 138 x 138. Each entry in row and column is a word. The following code is used to generate heatmap of the same matrix. But I am not able to show all the words in the plot.
It seems the values shown are also wrong in the color scale. While the values in matrix range from 3.2 to -0.2, the values shown in the heat map are from 0.1 to -0.1. How do I plot a heatmap with a numpy matrix?
fig = plt.figure()
ax = fig.add_subplot(111)
cax = ax.matshow(fooarray, interpolation='nearest', cmap='hot')
fig.colorbar(cax)
ax.set_xticklabels([' | '] + labels)
ax.set_yticklabels(['|'] + labels)
plt.show()