简体   繁体   English

如何在 python 的 PCA 图中找到数据点?

[英]How can I find the data point in my PCA plot in python?

I made this PCA plot in python and I want to know the name or index of each point how can I find a way?我在 python 中制作了这个 PCA 图,我想知道每个点的名称或索引如何找到方法?

def pca_arrows_2d(df, pca) :

    feature_vectors = pca.components_.T

    # échelle des flèches
    arrow_size, text_pos = 7.0, 8.0,

    # projections des vecteurs de caractéristiques
    for i, v in enumerate(feature_vectors):
        plt.arrow(0, 0, arrow_size*v[0], arrow_size*v[1], 
                  head_width=0.2, head_length=0.2, linewidth=2, color='red', alpha = 0.5)
        plt.text(v[0]*text_pos, v[1]*text_pos, df.columns[i], color='grey', 
                 ha='center', va='center', fontsize=18)

sns.pairplot(x_vars=[0], y_vars=[1], data=df_pca, hue="classes", height=10)
pca_arrows_2d(X, pca)

主成分分析

Use visualization package plotly to create plots.使用可视化包 plotly 创建绘图。 You can move cursors around the plot and see the data and points.您可以在绘图周围移动光标并查看数据和点。 Plotly helps you to find the data and identify the data points in the visualization and its very simple to use. Plotly 可帮助您查找数据并识别可视化中的数据点,并且使用起来非常简单。

You can also refer this:你也可以参考这个:

How can I find the data point in my PCA plot in r? 如何在 r 的 PCA 图中找到数据点?

I hope this helps and this is what you wanted?我希望这会有所帮助,这就是您想要的?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何显示我的 PCA 图? - How can I get my PCA plot graph to display? 如何将我的 PCA 结果应用于未标记的数据? - How can I implement my PCA results to my unlabelled data? 如何在 python 中使用 for 循环 plot 数据? - how can I plot data with a for loop in python? 如何使用 Python 绘制这些数据? - How can I plot this data using Python? 我如何告诉python我的数据结构(二进制)是什么样子,以便我可以绘制它? - How do I tell python what my data structure (that is in binary) looks like so I can plot it? 如何在 python 中使用 PCA 绘制 3D 平面? - How can I draw 3D plane using PCA In python? 如何在 Python 中将 PCA 用于术语文档矩阵? - How can I use the PCA for a term-document matrix in Python? python 2.7 matplotlib pylab:我的情节是空的。 如何使数据点显示在图中? - python 2.7 matplotlib pylab : My plot is empty. How can I make the data points show up in the plot? 如何读取我的 exel 表中的特定数据并从读取的每个数据集创建一个图? (Python) - How can I read specific data in my exel sheet and create a plot from each dataset that is read? (Python) 为什么我可以调用从原始数据到 plot 的 PCA numpy.ndarray 的密钥? - Why can I call upon a key from the original data to a plot for a PCA numpy.ndarray?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM