我试图在不使用 Numpy 的情况下进行绘图,但是我可以写什么来替代以下函数?
我发现的一些函数的替代方案给出了不同的输出。
vel = np.zeros([n, m, 2], dtype = float) -----> vel = [ [ [0.0 for i in range(2)] for j in range(m) ] for k in range(n) ] gives different output.
xlins = np.linspace(0, m-1, m) ------> xlins = [i for i in range(m)] did not run.
psi = 2d array
def PlotData(psi, m, n, scale):
psi = list(map(list, zip(*psi)))
#psi = np.flip(psi, 0)
psi = psi[::-1]
vel = np.zeros([n, m, 2], dtype = float)
#vel = [ [ [0.0 for i in range(2)] for j in range(m) ] for k in range(n)]
#rgb = np.zeros([n, m, 3], dtype = int)
rgb = [ [ [0 for i in range(3)] for j in range(m) ] for k in range(n) ]
.
.
.
.
xlins = np.linspace(0, m-1, m)
#xlins = [i for i in range(m)]
ylins = np.linspace(0, n-1, n)
#ylins = [float(i) for i in range(m)]
plt.streamplot(xlins, ylins, vel[:,:,0], vel[:,:,1], color='k', density=1)
我想在不使用 Numpy 的情况下获得相同的输出。