python - 我在哪里可以找到关于 seaborn 中的联合绘图函数或 Python 中的 matplotlib 中的此参数“joint_kws”的详细定义?
问题描述
以下是该功能的说明:</p>
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'这样的字典来控制情节,但是你在哪里可以找到这些字典的定义和用法呢?我在官方文档中没有看到。谁能帮我?谢谢!
解决方案
正如文档所说,这些字典被传递给用于在关节轴或边缘轴上绘制的绘图函数。因此,要传递的实际密钥取决于您所做的情节类型。
例如,如果您正在这样做,jointplot(..., kind="kde", ...)
那么 seaborn 将用于sns.kdeplot()
在关节轴上进行绘图,因此可以传递给该函数的任何参数都可以在joint_kws=
. 查看的定义sns.kdeplot()
,我发现我可以传递一个参数shade=
(“如果为真,则在 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()
来绘制实际的情节。我可以查看定义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))
推荐阅读
- ruby - 如何让这个红宝石块将每个单独的哈希添加到数组中,而不是多次添加一个哈希?
- javascript - 如何在使用的语言条件下使用 css 增加文本的空间宽度?
- c - 将地址int“i”分配给指针“p”时,“p = &i”和“*p = i”之间有什么区别吗
- mysql - SQL multiple values in Where = "N"
- python - 如何在石榴中加入先验信息?换句话说:石榴支持增量学习吗?
- arrays - 按值对数组的哈希进行排序
- python - 两个矩阵参数的多元函数
- reactjs - 如何修复 Typescript 错误 TS2314、TS 2339 防止 Yarn Build
- cron - How can I get a crontab job to append values onto a new line instead of carrying on from the previous line?
- python - 从函数返回的生成器过早完成