Two-dimensional array drawing

import numpy as np
import matplotlib.pyplot as plt
data = np.zeros((360, 360))
data[120:160, 120:240] = 1
data[160:240, 160:200] = 1
print(type(data))
plt.imshow(data)
plt.show()

The key lies in the plt.imshow method, just put the data directly in, and the drawing is a "T" shape

Guess you like

Origin blog.csdn.net/huatianxue/article/details/108573789