Python 绘图工具详解:使用 Matplotlib、Seaborn 和 Pyecharts 绘制散点图
目录

数据可视化
1.使用 matplotlib 库
import matplotlib.pyplot as plt # 创建数据 x =[1,2,3,4,5] y =[2,3,5,7,11]# 使用matplotlib绘制散点图 plt.scatter(x, y, label='Data Points', color='blue', marker='o')# 添加标签和标题 plt.xlabel('X-axis') plt.ylabel('Y-axis') plt.title('Scatter Plot')# 添加图例和网格 plt.legend() plt.grid(True)# 显示图形 plt.show()
matplotlib 库
- 导入库:
import matplotlib.pyplot as plt - 创建数据:
x = [1, 2, 3, 4, 5]和y = [2, 3, 5, 7, 11] - 绘制散点图:
plt.scatter(x, y, label='Data Points', color='blue', marker='o') - 添加标签和标题:
plt.xlabe