我在哪里可以找到有关 seaborn 中的联合绘图函数或 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?

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

问题描述

以下是该功能的说明:

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=(如果为真,则在 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 中的联合绘图函数或 Python 中的 matplotlib 中此参数“joint_kws"的详细定义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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