学习笔记
[2,3]
*[2,3] 变为 2,3 即无括号
for i in range(100):
print(np.random.rand(2))
输出 二维0~1的数组
[0.44140353 0.98570772]
[0.34604834 0.60102605]
[0.8243352 0.82160222]
a1xy_ = np.array([1, 2])
finger = np.array([3, 4])
dist1 = np.array([5, 6])
dist2 = np.array([7, 8])
on_goal = 0
s = np.concatenate((a1xy_, finger, dist1 + dist2, [1. if on_goal else 0.]))
print(s)
b = a[i:j]
b = a[i:j:s]
d=a[:-1]
'''动态双图展示1'''
a=[]
b=[]
fig, ax = plt.subplots(nrows=2, ncols=1)
for i in range(10):
a.append(np.sin(i))
b.append(np.cos(i))
ax[0].cla()
ax[1].cla()
ax[0].plot(a)
ax[1].plot(b)
plt.pause(0.5)
plt.show()
'''动态双图展示2'''
a=[]
b=[]
fig = plt.figure()
ax1 = fig.add_subplot(211)
ax2 = fig.add_subplot(212)
for i in range(10):
a.append(np.sin(i))
b.append(np.cos(i))
ax1.cla()
ax2.cla()
ax1.plot(a)
ax2.plot(b)
plt.pause(0.5)
plt.show()