三维马的二维投影:
import pandas as pd
from sklearn.decomposition import PCA
import seaborn
from matplotlib import pyplot as plt
from nlpia.data.loaders import get_data
pd.set_option('display.max_columns', 6)
# 点云数据
df = get_data('pointcloud').sample(1000)
pca = PCA(n_components=2)
# 将三维点云缩减为二维投影,以便在二维散点图中显示
df2d = pd.DataFrame(pca.fit_transform(df), columns=list('xy'))
df2d.plot(kind='scatter', x='x', y='y')
plt.show()