#2022.5.30 #by 秦舞阳 import matplotlib.pyplot as plt from numpy.random import rand import random #显示中文 plt.rcParams['font.sans-serif']=['SimHei'] plt.rcParams['axes.unicode_minus'] = False def randomcolor(): colorArr = ['1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'] color = "" for i in range(6): color += colorArr[random.randint(0,14)] return "#"+color fig, ax = plt.subplots() for i in range(100): x, y = rand(2, 1) scale = 20.0 ax.scatter(x, y, c=randomcolor(), s=scale, alpha=0.9, edgecolors=randomcolor()) ax.legend() plt.show()
随机颜色点的随机分布散点图
于 2022-05-30 23:56:05 首次发布