hsv_1
Former-commit-id: 57a8fb7799ea7543b4af1ea49626346d50546f82
This commit is contained in:
29
Picture_Train/show.py
Normal file
29
Picture_Train/show.py
Normal file
@ -0,0 +1,29 @@
|
||||
|
||||
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()
|
Reference in New Issue
Block a user