Python 我如何显示种类=“;swarm“;和种类;“点”;在Seaborn的同一个catplot上?

Python 我如何显示种类=“;swarm“;和种类;“点”;在Seaborn的同一个catplot上?,python,matplotlib,seaborn,catplot,Python,Matplotlib,Seaborn,Catplot,我试图在Seaborn中显示叠加在同一catplot上的均值和误差(kind=“point”)以及单个数据点(kind=“swarm”) 我有以下代码: sns.catplot(x="Variable_A", y="Dependent_Variable", col="Variable_B", data=LRP_df, kind="swarm", color = "black") sns.catp

我试图在Seaborn中显示叠加在同一catplot上的均值和误差(kind=“point”)以及单个数据点(kind=“swarm”)

我有以下代码:

sns.catplot(x="Variable_A", y="Dependent_Variable", col="Variable_B", data=LRP_df, kind="swarm", color = "black")

sns.catplot(x="Variable_A", y="Dependent_Variable", col="Variable_B", data=LRP_df, kind="point", color = "red")

sns.despine()
将分别生成绘图:

我怎样才能使两个图位于同一轴线上


谢谢

使用面网格,可以通过使用map_dataframe()指定每个面来覆盖每个面网格。本文中的示例已修改。数据基于样本数据

import seaborn as sns

sns.set_theme(style="ticks")
exercise = sns.load_dataset("exercise")

g = sns.FacetGrid(exercise, col="kind")
g.map_dataframe(sns.stripplot, x="time", y="pulse", color="black")
g.map_dataframe(sns.pointplot, x="time", y="pulse", color="red")
g.set_axis_labels("time", "pulse")

如果我的回答对你有帮助,请考虑接受它作为正确的答案。