How to annotated labels to a 3D matplotlib scatter plot?
问题 I have run a sklearn - Principal Component Analysis on my data with 3 principal components (PC1, PC2, PC3). The data looks like this (it's a pandas DataFrame): Here is the code for plotting the principle components: from mpl_toolkits.mplot3d import axes3d import matplotlib.pyplot as plt %matplotlib fig = plt.figure() ax = fig.gca(projection='3d') ax.set_title('3D Scatter Plot') ax.set_xlabel('PC1') ax.set_ylabel('PC2') ax.set_zlabel('PC3') ax.view_init(elev=12, azim=40) # elevation and angle