海洋猫图+条形图:额外轴

我使用Seaborn/Matplotlib为不同的参数显示不同的输出(例如时间和距离)。我想将这两个输出关联到同一个图上,因此我使用了seaborn的satplot和barplot。

我的问题是我没有得到预期的显示。图在这里,但出现了一些嘈杂的额外轴。

我正在运行以下代码

ax = plt.subplot(311)
ax2 = ax.twinx()

data = sns.load_dataset("tips")
sns.barplot(ax=ax, x="day",y="total_bill", hue="size" , data=data, ci=None)
ax.set_yscale("log")

sns.catplot(data=data, x="day", y="tip", ax=ax2, hue="size", kind="swarm", palette="bright")

我得到了以下结果:

?

?

你能帮我去掉这个多余的轴吗?当有多个子图时,这尤其不方便。

转载请注明出处:http://www.heshunyou.com/article/20230526/1416300.html