欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

matplotlib 散点图

程序员文章站 2022-03-18 21:37:28
...
import matplotlib.pyplot as plt
import numpy as np
# 保证图片在浏览器内正常显示
import time
start=time.time()
# 10个点
N = 10
x = ['Sur', "Fea", "Dis", "Hap", "Sad", "Ang", "Nat", "XXX", "YYY", "ZZZ"]
y = [0,10,20,30,40,50,60,70,80,90]
# 每个点随机大小
s = 100
# 随机颜色
c = np.random.rand(N)
plt.ylim(0,100)

ax = plt.gca()
ax.spines['top'].set_color('none')
ax.spines['right'].set_color('none')

plt.scatter(x, y, s=s, c=c, alpha=0.5)
print(time.time()-start)
plt.show()
if __name__ == '__main__':
    pass
相关标签: matplot