Python heatmap plot colorbar
<p>I am working on a plot which looks like this so far:</p>
<p><a href="https://i.stack.imgur.com/xHtoW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xHtoW.png" alt="enter image description here" /></a></p>
<p>And I am using the following code:</p>
<pre><code>import matplotlib.pyplot as plt
import numpy as np
column_labels = ['A','B']
row_labels = ['A','B']
data = np.random.rand(2,2)
print(type(data))
data = np.array([[1, 0.232], [0.119, 1]])
fig, ax = plt.subplots()
heatmap = ax.pcolor(data, cmap=plt.cm.Blues)

# put the major ticks at the middle of each cell
ax.set_xticks(np.arange(data.shape[0])+0.5, minor=False)
ax.set_yticks(np.arange(data.shape[1])+0.5, minor=False)

# want a more natural, table-like display
ax.invert_yaxis()
ax.xaxis.tick_top()

ax.set_xticklabels(row_labels, minor=False)
ax.set_yticklabels(column_labels, minor=False)
plt.show()
</code></pre>
<p>What I am trying to get is something like this one:</p>
<p><a href="https://i.stack.imgur.com/5sFDv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5sFDv.png" alt="enter image description here" /></a></p>
<p>Where I can see the color bar as well as value of the cells on them. What would I need to add to my code to get these?</p>
<p>Thanks</p>