I have calculated an array with how many % of the total number of permutations contain all different pairs combinations. Now I want to visualise this as for example a heat map. I have the following code for calculation:
#occurrences matrix
a = np.array(np.array_split(np.random.binomial(1,.5,30),10), dtype='f')
#co-occurrences matrix
acov=np.dot(a.T, a)
acov[np.diag_indices_from(acov)]=0
acov /= acov.sum()
And then i try this for visualisation:
plt.imshow(acov,interpolation='nearest')
plt.colorbar()
plt.show()
However I dont really know what im doing, first time I use a heatmap so not sure what im seeing. What I would like is a graph with the same shape as the array where each square has a colour intensity representing how large it is on a scale from 0-1.
what about this?
plt.imshow(acov,interpolation='nearest', cmap='Reds')
plt.colorbar()
plt.show()

using seaborn.heatmap():
sns.heatmap(acov)

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With