def joint_overplot(x, y, df, fig, color='r', marg_kws=None):
"""Overplot additional data on existing JointGrid instance.
Args:
x (str):
y (str):
df (DataFrame):
fig: seaborn JointGrid instance.
color (str): Color.
marg_kws (dict): Keyword arguments to pass to plot_marginals().
Returns:
fig: seaborn JointGrid instance.
"""
if marg_kws is None:
marg_kws = dict(norm_hist=True,
hist_kws=dict(weights=df.Survivors.values))
fig.x = df[x]
fig.y = df[y]
fig.plot_joint(plt.scatter, c=color)
fig.plot_marginals(sns.distplot, color=color, kde=False, axlabel=False,
**marg_kws)
return fig
评论列表
文章目录