首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在seaborn中的jointplot函数或Python中的matplotlib中,哪里可以找到关于这个参数'joint_kws‘的详细定义?

在seaborn中的jointplot函数或Python中的matplotlib中,哪里可以找到关于这个参数'joint_kws‘的详细定义?
EN

Stack Overflow用户
提问于 2018-09-13 21:21:52
回答 1查看 2.2K关注 0票数 6

以下是对此函数的描述:

代码语言:javascript
复制
def jointplot(x, y, data=None, kind="scatter", stat_func=stats.pearsonr,
          color=None, size=6, ratio=5, space=.2,
          dropna=True, xlim=None, ylim=None,
          joint_kws=None, marginal_kws=None, annot_kws=None, **kwargs)

下面是最后几个操作参数的描述:

代码语言:javascript
复制
{joint, marginal, annot}_kws : dicts, optional
    Additional keyword arguments for the plot components.
kwargs : key, value pairings
    Additional keyword arguments are passed to the function used to
    draw the plot on the joint Axes, superseding items in the
    ``joint_kws`` dictionary.

文档提到我可以传入一个像'joint_kws‘或'marginal_kws’这样的字典来控制绘图,但是你在哪里可以找到这些字典的定义和用法呢?我没有在官方文档中看到它。有谁能帮帮我呢?谢谢!

EN

回答 1

Stack Overflow用户

发布于 2018-09-13 21:30:15

正如文档所述,这些字典被传递给用于在关节轴或边缘轴上绘制的绘图函数。因此,要传递的实际密钥取决于您所做的绘图类型。

例如,如果您正在执行jointplot(..., kind="kde", ...),则seaborn将使用sns.kdeplot()在关节轴上进行绘制,因此可以传递给该函数的任何参数都可以在joint_kws=中提供。查看the definition of sns.kdeplot(),我看到我可以传递一个参数shade= ("If True,在KDE曲线下的区域中着色(或者当数据是双变量时用填充的等高线绘制)。“),因此,我可以在joint_kws字典中传递这个参数:

代码语言:javascript
复制
iris = sns.load_dataset("iris")
g = sns.jointplot("sepal_width", "petal_length", data=iris,kind="kde",
                  space=0, color="g", joint_kws=dict(shade=False))

如果我要运行sns.jointplot(..., kind='scatter',...),那么seaborn将使用plt.scatter()来绘制实际的绘图。我可以查看at the definition for pyplot.scatter(),看看我可以在字典中使用哪些键:

代码语言:javascript
复制
tips = sns.load_dataset("tips")
g = sns.jointplot(x="total_bill", y="tip", data=tips, kind='scatter', joint_kws=dict(marker='D', s=50))
票数 7
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52314676

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档