我有三个数据集,现在我正在制作三个不同的方框图。现在我正在使用:
chart1 = sns.catplot(x="Provider", y="Appearances", kind="box", data=mlt_sample1k)
chart2 = sns.catplot(x="Provider", y="Appearances", kind="box", data=mlt_sample10k)
chart3 = sns.catplot(x="Provider", y="Appearances", kind="box", data=mlt_sample100k)
其中mlt_sample1k
、mlt_sample10k
和mlt_sample100k
是我的三个数据帧
我想将它们组合成一个单独的方框图,每个提供程序有3个平行方框,如示例from the docs.中所示,类似于:
但是有3个盒子,Thu、Fri等将是我的“提供者”类别。我在他们使用的文档中看到:
ax = sns.boxplot(x="day", y="total_bill", hue="smoker",
data=tips, palette="Set3")
但是,这对我不起作用,因为我必须指定三个数据集,每个框一个。我该怎么做
编辑:“我的数据帧”的结构始终相同:
item | provider | appearances
'dog' 'prov1' 0.001
'cat' 'prov2' 0.02
'pig' 'prov1' 0.03
...
根据外观列,方框图表示每个数据帧中每个提供程序(总共6个)的项目统计信息
这三个数据帧的长度不同
IIUC,您可以
concat
三个数据帧和assign
一列用作色调,如下所示:相关问题 更多 >
编程相关推荐