I am trying to add 8 heatmaps (subplots) to a figure but I can't seem to manage it. Could you please help me?
# in order to modify the size
fig = plt.figure(figsize=(12,8))
# adding multiple Axes objects
fig, ax_lst = plt.subplots(2, 4) # a figure with a 2x4 grid of Axes
letter = "ABCDEFGH"
for character in letter:
x = np.random.randn(4096)
y = np.random.randn(4096)
heatmap, xedges, yedges = np.histogram2d(x, y, bins=(64,64))
extent = [xedges[0], xedges[-1], yedges[0], yedges[-1]]
# Plot heatmap
plt.clf()
plt.title('Pythonspot.com heatmap example')
plt.ylabel('y')
plt.xlabel('x')
plt.imshow(heatmap, extent=extent)
plt.colorbar()
plt.show()
Thank you!