我正在制作一个 3D 图,其中每个点都是一个特定的标签 (0-9)。我知道哪些点是哪个标签并使用一个看起来像 [0, 3, ... 6, 7, 9] 的数组给它们着色(数组的每个元素都指定了 3-d 中相应点的标签。我得到了每个点都是不同的颜色,但我不确定如何添加一个图例来指定每个点对应的标签。这是下面的代码片段:
fig = plt.figure(figsize = (10,10))
ax = fig.gca(projection='3d')
color = np.argmax(output_np, axis = 1) #specifies the color/label of each pt
#plotting matrix[i] = x, y, z coordinate of point
ax.scatter(plotting_matrix[0], plotting_matrix[1], plotting_matrix[2], c = color, cmap = 'plasma')
ax.legend()
这是输出图。我想要一个显示每种颜色的数字/标签的图例: Output Image