pd.plotting.scatter_matrix()

这个例子展示了如何利用pandas的plotting模块创建一个散点图矩阵。该矩阵包含DataFrame的多个列之间的散点图,对角线部分可以是直方图或核密度估计图。参数包括透明度、图大小、标记类型、网格显示等,提供了自定义图表的选项。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

pd.plotting.scatter_matrix()


Signature:
pd.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,
)
Docstring:
Draw a matrix of scatter plots.

Parameters
----------
frame : DataFrame
alpha : float, optional
    Amount of transparency applied.
figsize : (float,float), optional
    A tuple (width, height) in inches.
ax : Matplotlib axis object, optional
grid : bool, optional
    Setting this to True will show the grid.
diagonal : {'hist', 'kde'}
    Pick between 'kde' and 'hist' for either Kernel Density Estimation or
    Histogram plot in the diagonal.
marker : str, optional
    Matplotlib marker type, default '.'.
density_kwds : keywords
    Keyword arguments to be passed to kernel density estimate plot.
hist_kwds : keywords
    Keyword arguments to be passed to hist function.
range_padding : float, default 0.05
    Relative extension of axis range in x and y with respect to
    (x_max - x_min) or (y_max - y_min).
**kwargs
    Keyword arguments to be passed to scatter function.

Returns
-------
numpy.ndarray
    A matrix of scatter plots.

Examples
--------

.. plot::
    :context: close-figs

    >>> df = pd.DataFrame(np.random.randn(1000, 4), columns=['A','B','C','D'])
    >>> pd.plotting.scatter_matrix(df, alpha=0.2)
File:      d:\programdata\anaconda3\lib\site-packages\pandas\plotting\_misc.py
Type:      function
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

yangbocsu

你的鼓励将是我创作的最大动力!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值