散点图
点击查看代码
import matplotlib.pyplot as plt
import pandas as pd
import matplotlib
plt.rcParams["font.sans-serif"] = ["SimHei"] # 解决英文冲突问题
matplotlib.use('TkAgg')
x = [1, 2, 3, 4, 5, 6]
y = [19, 29, 39, 22, 33, 49]
plt.scatter(x, y, color="red")
# scatter 撒,分散
# color="red" 表示点的颜色
# 与折线图差异点plt.plot() 改为 plt.scatter()
plt.show()
![](/i/l/?n=23&i=blog/3015067/202309/3015067-20230916183929943-434083205.png)
<details>
<summary>点击查看代码</summary>
点击查看代码
<details>
<summary>点击查看代码</summary>
</details>