I have a 2d numpy array translated to a rectangular graph with matplotlib.pyplot.imshow I am trying to achive 2 more points
Relevant code:
import matplotlib.pyplot as plt
plt.figure(figsize = (10,10))
plt.axis('on')
plt.imshow( res[1], interpolation='nearest', alpha =0.7)
#res[1] is a 2d numpy array (like in the screenshot bellow)
plt.jet()
#plt.colorbar()
plt.show()
I would like the labels to look something like this:
This is what I have now:
What you need is something like this:
fig, ax = plt.subplots()
im = ax.imshow(z_matrix.T)
for i in range(z_matrix.T.shape[0]): # rows
for j in range(z_matrix.T.shape[1]): # columns
text = ax.text(j, i, z_matrix.T[i, j],
ha="center", va="center", color="black")
SOURCE: https://matplotlib.org/3.1.0/gallery/images_contours_and_fields/image_annotated_heatmap.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.