Files
ai-titration/Picture_Train/show.py
flt6 a6b9531df5 hsv_1
Former-commit-id: 57a8fb7799ea7543b4af1ea49626346d50546f82
2025-05-16 15:46:34 +08:00

30 lines
727 B
Python

import matplotlib.pyplot as plt
import random
# 创建一个 3D 图形
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
# 为每个 key 分配一个随机颜色
colors = {"orange":(1,0,0),"yellow":(0,1,0)}
# for key in d.keys():
# colors[key] = (random.random(), random.random(), random.random()) # 随机 RGB 颜色
# 绘制每个 key 的点
for key, points in d.items():
x_vals = [point[0] for point in points]
y_vals = [point[1] for point in points]
z_vals = [point[2] for point in points]
ax.scatter(x_vals, y_vals, z_vals, label=key, color=colors[key])
# 添加图例和标签
ax.set_xlabel('X轴')
ax.set_ylabel('Y轴')
ax.set_zlabel('Z轴')
ax.legend()
# 显示图形
plt.show()