Cant find why it wont work! I supposed to generate random numbers than repeat running until they all reshape perfectly and plot into a 3d graph. SImple #9
import random
import matplotlib.pyplot as plt
import numpy as np
f=np.array([1,1])
g=np.array([1])
t=np.array([1])
while f.shape!=g.shape and t.shape!=f.shape and g.shape!=t.shape:
c=np.array([])
d=np.array([])
h=np.array([])
for i in range(1,201,1):
a=random.randint(1,100)
b=random.randint(1,100)
i=random.randint(1,100)
c = np.append(c, a)
d = np.append(d, b)
h = np.append(h, i)
print(c)
A=c.reshape(10,20)
B=d.reshape(10,20)
N=h.reshape(10,20)
f=A[A<500]
g=B[B<500]
t=N[N<500]
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.scatter(f, g, t, color="red",label="Array", marker="o")
plt.show()
import random import matplotlib.pyplot as plt import numpy as np
f=np.array([1,1]) g=np.array([1]) t=np.array([1]) while f.shape!=g.shape and t.shape!=f.shape and g.shape!=t.shape: c=np.array([]) d=np.array([]) h=np.array([]) for i in range(1,201,1): a=random.randint(1,100) b=random.randint(1,100) i=random.randint(1,100) c = np.append(c, a) d = np.append(d, b) h = np.append(h, i) print(c) A=c.reshape(10,20) B=d.reshape(10,20) N=h.reshape(10,20) f=A[A<500] g=B[B<500] t=N[N<500] fig = plt.figure() ax = fig.add_subplot(111, projection='3d') ax.scatter(f, g, t, color="red",label="Array", marker="o") plt.show()