Python 是否可以使用色调参数在Seaborn jointgrid中获得lmplot?

Python 是否可以使用色调参数在Seaborn jointgrid中获得lmplot?,python,python-3.x,seaborn,Python,Python 3.x,Seaborn,有没有办法在JointGrid中获得lmplot或线性回归线 我当前的代码与Seaborn文档中的示例基本相同: penguins = sns.load_dataset("penguins") sns.jointplot(data=penguins, x="bill_length_mm", y="bill_depth_mm", hue="species") 我还尝试使用了g.plot(sns.lmplot,sns

有没有办法在JointGrid中获得lmplot或线性回归线

我当前的代码与Seaborn文档中的示例基本相同:

penguins = sns.load_dataset("penguins")
sns.jointplot(data=penguins, x="bill_length_mm", y="bill_depth_mm", hue="species")

我还尝试使用了
g.plot(sns.lmplot,sns.lineplot)
,以及kdeplot。我想要的是下面这个(但是没有两边的小线条)。这是用MatLab制作的,试图在Python中找到一个等价物


提前感谢您的帮助。

您可以通过
JointGrid
作为
g.ax\u XXXX
访问各个轴。从那里,您可以使用
regplot(…,ax=g.ax\u joint)
简单地绘制回归

x_col = "bill_length_mm"
y_col = "bill_depth_mm"
hue_col = "species"

penguins = sns.load_dataset("penguins")
g = sns.jointplot(data=penguins, x=x_col, y=y_col, hue=hue_col)

for _,gr in penguins.groupby(hue_col):
    sns.regplot(x=x_col, y=y_col, data=gr, scatter=False, ax=g.ax_joint, truncate=False)