在哪里可以在seaborn的jointplot函数或Python的matplotlib中找到有关此参数'joint_kws'的详细定义? [英] where can I find the detailed definition about this parameter 'joint_kws' in jointplot function in seaborn or matplotlib in Python?

查看:302
本文介绍了在哪里可以在seaborn的jointplot函数或Python的matplotlib中找到有关此参数'joint_kws'的详细定义?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是对此功能的说明:

The following is a description of this function:

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)

以及以下是最后几个可选参数的说明:

and the following is the description of the last few oprional parameters:

{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"之类的字典来控制绘图,但是在哪里可以找到这些字典的定义和用法?我没有在官方文档中看到它. 谁能帮我?谢谢!

The document mentions that I can pass in a dictionary like 'joint_kws' or 'marginal_kws' to control the plot, but where can you find the definition and usage of these dictionaries? I did not see it in the official documentation. Who can help me? thx!

推荐答案

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

As the documentation says, these dictionaries are passed to the plotting function used to plot either on the joint axes, or the marginal axes. The actual keys that are to be passed therefore depend on the kind of plot your doing.

例如,如果您正在执行jointplot(..., kind="kde", ...),则seaborn将使用 sns.kdeplot() 进行关节轴上的绘图,因此可以在joint_kws=中提供可以传递给该函数的任何参数.查看 sns.kdeplot() 的定义,我看到我可以传递参数shade=(如果为True,则在KDE曲线下方的区域中着色(或在数据为双变量时绘制填充轮廓)."),因此,我可以在joint_kws词典中传递该参数:

for example, if you are doing jointplot(..., kind="kde", ...) then seaborn would use sns.kdeplot() to do the plotting on the joint axes, and therefore any argument that can be passed to that function can be provided in joint_kws=. Looking at the definition of sns.kdeplot(), I see that I can pass an argument shade= ("If True, shade in the area under the KDE curve (or draw with filled contours when data is bivariate)."), therefore, I can pass that argument in the joint_kws dictionary:

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()绘制实际图.我可以在的定义中找到pyplot.scatter() ,然后查看我可以在字典中使用哪些键:

If I were to run sns.jointplot(..., kind='scatter',...) then seaborn would use plt.scatter() to draw the actual plot. I can look at the definition for pyplot.scatter() and see which keys I can use in my dictionary:

tips = sns.load_dataset("tips")
g = sns.jointplot(x="total_bill", y="tip", data=tips, kind='scatter', joint_kws=dict(marker='D', s=50))

这篇关于在哪里可以在seaborn的jointplot函数或Python的matplotlib中找到有关此参数'joint_kws'的详细定义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆