Boz*_*ang 5 python matplotlib seaborn jupyter-notebook
下面是这个功能的说明?
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)
Run Code Online (Sandbox Code Playgroud)
以下是最后几个可选参数的说明:
{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.
Run Code Online (Sandbox Code Playgroud)
文档提到我可以传入'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))
Run Code Online (Sandbox Code Playgroud)
如果我要跑,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))
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1996 次 |
| 最近记录: |