I plotted the eigenvectors of some 3D-data and was wondering if there is currently (already) a way to put arrowheads on the lines? Would be awesome if someone has a tip for
Another option: you can also use the plt.quiver function, which allows you to produce arrow vectors pretty easily without any extra imports or classes.
To replicate your example, you would replace:
for v in eig_vec:
ax.plot([mean_x, v[0]], [mean_y, v[1]], [mean_z, v[2]], color='red', alpha=0.8, lw=3)
with:
for v in eig_vec:
ax.quiver(
mean_x, mean_y, mean_z, # <-- starting point of vector
v[0] - mean_x, v[1] - mean_y, v[2] - mean_z, # <-- directions of vector
color = 'red', alpha = .8, lw = 3,
)