boren - 数据分析

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()

发布了516 篇原创文章 · 获赞 21 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/houlaos/article/details/105173760