import matplotlib.pyplot as plt
data_dict = {4: [0, 1, 0, 0, 2], 5: [0, 1, 1, 1, 1], 6: [1, 0, 0, 1, 1], 10: [2, 4, 3, 3, 1]}
print(data_dict)
size_constant = 20
for xe, ye in data_dict.items():
xAxis = [xe] * len(ye)
# square it to amplify the effect, if you do ye.count(num)*size_constant the effect is barely noticeable
sizes = [ye.count(num) ** 2.5 * size_constant for num in ye]
plt.scatter(xAxis, ye, s=sizes)
plt.yticks(range(0, max(np.array(aco_repeat_num)[:, 0]) + 1))
plt.title('repeat number')
plt.show()
python 画散点图对于同一数据出现多次的情况
最新推荐文章于 2023-02-20 18:33:27 发布