import matplotlib.pyplot as plt
# x**4 - 8*x + 4 = 0
# 无解
x = []
y = []
y2 = []
for i in range(-100,100):
x.append(i)
y.append(i**2 - 8*i + 4)
y2.append(10)
print(x)
print(y)
# bar
plt.bar(x,y,color=["#00FFFF","#FF0000"],alpha=1,width=20) # RGB
# 16进制 0 1 2 3 4 5 6 7 8 9 A B C DE F
# 逢2进1 0 1 10 11 100
# 逢10 进1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# plt.plot(x,y)
plt.bar(x,y2)
plt.xlabel("x")
plt.ylabel("y")
plt.show()
import random
import matplotlib.pyplot as plt
a = []
for i in range(1000):
a.append(random.randint(30,50))
print(a)
# hist
plt.hist(a,bins=20)
plt.xlabel("x")
plt.ylabel("y")
plt.show()