I'd like to simply display the coordinates of, and next to, each point on this 3D scatter. I've seen this: Matplotlib: Annotating a 3D scatter plot, but need to know how to easily get and display the COORDINATES.
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
x = [1, 1, 2]
y = [1, 1, 2]
z = [1, 2, 2]
a = []
b = []
c = []
for item in x:
a.append(float(item))
for item in y:
b.append(float(item))
for item in z:
c.append(float(item))
print(a, b, c)
r = np.array(a)
s = np.array(b)
t = np.array(c)
print(r, s, t)
ax.set_xlabel("x axis")
ax.set_ylabel("y axis")
ax.set_zlabel("z axis")
ax.scatter(r,s,zs = t, s=200, label='True Position')
plt.show()
Thanks. It is this long to provide a simpler presentation of what's going on with the code. Any opinions on shortening it would be helpful, as well.