更改图例位置 seaborn factorplot

Changing legend location seaborn factorplot

g = sns.factorplot(x="time", y="pulse", hue="kind", col="diet", data=exercise)

在 seaborn 中,有没有办法在第一个子图中而不是第二个子图中绘制图例?这个例子来自这里:https://seaborn.pydata.org/generated/seaborn.factorplot.html?highlight=factor#seaborn.factorplot

以下应该有效。

g = sns.factorplot(x="time", y="pulse", hue="kind",
              col="diet", data=exercise, legend=False)
g.axes[0][0].legend()

PS:

还有一个更简单的方法:

g = sns.factorplot(x="time", y="pulse", hue="kind", col="diet",
                   data=exercise, legend_out=False)