from mpl_toolkits import mplot3d %matplotlib notebook fig = plt.figure(figsize=(5,5)) ax = plt.axes(projection='3d') ax.scatter3D(pdf.PC1, pdf.PC2, yy) ax.set_xlabel('PC1') ax.set_ylabel('PC2') ax.set_zlabel('y') plt.show()