python - 我在哪里可以找到有关 seaborn 中的联合绘图函数或 Python 中的 matplotlib 中此参数 'joint_kws' 的详细定义?

标签 python matplotlib jupyter-notebook seaborn

下面是这个函数的说明:

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)

以下是最后几个可选参数的说明:
{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'之类的字典来控制情节,但是在哪里可以找到这些字典的定义和用法?我在官方文档中没有看到它。
谁能帮我?谢谢!

最佳答案

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

例如,如果你正在做 jointplot(..., kind="kde", ...)那么 seaborn 将使用 sns.kdeplot() 在关节轴上进行绘图,因此可以在 joint_kws= 中提供可以传递给该函数的任何参数.看着 the definition of sns.kdeplot() ,我看到我可以传递一个参数 shade= (“如果为 True,则在 KDE 曲线下方的区域中添加阴影(或在数据为双变量时绘制填充轮廓)。”)因此,我可以在 joint_kws 中传递该参数。字典:

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() 并查看我可以在字典中使用哪些键:
tips = sns.load_dataset("tips")
g = sns.jointplot(x="total_bill", y="tip", data=tips, kind='scatter', joint_kws=dict(marker='D', s=50))

关于python - 我在哪里可以找到有关 seaborn 中的联合绘图函数或 Python 中的 matplotlib 中此参数 'joint_kws' 的详细定义?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52314676/

相关文章:

python - 优化python代码

python - 尝试将循环字符串添加到空数据框 Pandas

python - 在 Pandas Dataframe 的几列上填写 na

python - 如何找到两条线段的交点?

python - 如何在 matplotlib 箱线图中标记四分位数?

python - 在 Pycharm 中以与 Jupyter 相同的方式可视化数据?

python - 寻找二叉树中的最小值,Python

python - 在 matplotlib 中获取 colorbar 的刻度值

python - Append 函数无法退出 for 循环

python - Q : KDB+/PyQ publisher subscriber with feeds in python objects