简体   繁体   English

pandas.plotting scatter_matrix 混淆关于主对角线图

[英]pandas.plotting scatter_matrix confusion about main diagonal plots

I am a bit confused about how scatter_matrix in the pandas.plotting module works.我对scatter_matrix模块中的pandas.plotting的工作原理有点困惑。 eg, see the plot here https://www.geeksforgeeks.org/pair-plots-using-scatter-matrix-in-pandas/例如,请参阅 plot 此处https://www.geeksforgeeks.org/pair-plots-using-scatter-matrix-in-pandas/

The 3 plots along the main diagonal looks like distributions.沿主对角线的 3 个图看起来像分布。 But the y and x axis labels indicate it's plotting a variable vs. itself, so shouldn't it be a straight line?但是 y 和 x 轴标签表明它正在绘制一个变量与自身的关系,所以它不应该是一条直线吗? Where did the distribution come from?分布从何而来?

By default pandas.plotting.scatter_matrix plots histograms on the diagonal.默认情况下pandas.plotting.scatter_matrix在对角线上绘制直方图。 Each histogram shows the counts of just that column of data.每个直方图仅显示该数据列的计数。 Otherwise, as you mentioned, we'd only have (useless) straight lines on the diagonal.否则,正如您所提到的,我们在对角线上只有(无用的)直线。

There is a diagonal param to choose between a histogram or kernel density:有一个diagonal参数可以在直方图或 kernel 密度之间进行选择:

pandas.plotting.scatter_matrix(frame, alpha=0.5, figsize=None, ax=None, grid=False, diagonal='hist', marker='.', density_kwds=None, hist_kwds=None, range_padding=0.05, **kwargs)

... ...

diagonal{'hist', 'kde'} : Pick between 'kde' and 'hist' for either Kernel Density Estimation or Histogram plot in the diagonal. diagonal{'hist', 'kde'} :在对角线上的 Kernel 密度估计或直方图 plot 之间选择“kde”和“hist”。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM