将两个数据框的两个图合并为一个图

时间:2020-07-03 07:30:38

标签: python pandas

我想将两个图合并为一个图。 我认为这很简单,但我无法弄清楚。哈哈..

sns.countplot(x=low_tenure.Partner)

enter image description here

sns.countplot(x=high_tenure.Partner)

enter image description here

所以我可以比较两个图

感谢您对我的帮助:)

2 个答案:

答案 0 :(得分:2)

您可以使用公共轴。

data=json.dumps(payload)

答案 1 :(得分:1)

如果要使用seaborn一起绘制它们,最好先合并两个DataFrame。

low_tenure['cat'] = 'Low tenure'
high_tenure['cat'] = 'High tenure'
df_combined = pd.concat([low_tenure, high_tenure])
sns.countplot(x='Partner', hue='cat', data=df_combined)
相关问题