我想给数据中的每个点(3D)和标签(标签是字典中的键)添加标签:
l = list(dictionary.keys())
#transform the array to a list
arrayx=arrayx.tolist()
arrayy=arrayy.tolist()
arrayz=arrayz.tolist()
#arrayx contains my x coordinates
ax.scatter(arrayx, arrayy, arrayz)
#give the labels to each point
for label in enumerate(l):
ax.annotate(label, ([arrayx[i] for i in range(27)],[arrayy[i]for i in range(27)],[arrayz[i] for i in range(27)]))
plt.title("Data")
plt.show()
我的意见:
阵列X:
^{pr2}$阵列:
[[0.1], [2], [3], [6], [5], [16775708773695687]...]
阵列:
[1], [2], [3], [4], [5], [6]...]
并给图形中的每个点3D标注
借用@martin evans的代码答案,但是使用
zip
您可以为每个点添加文本,如下所示:
这将为您提供以下输出:
相关问题 更多 >
编程相关推荐