seaborn 如何在数据框中创建仅包含特定属性的箱线图

seaborn how do i create a box plot of only particular attributes in a dataframe

我想创建两个箱线图,通过根据属性的比例拆分属性来可视化数据中的不同属性。我目前有这个

显示属性分布的箱线图

sns.boxplot(data=df)

box plot with all attributes included

我希望它像下面的图片一样,根据比例在不同的箱线图中显示属性,但每个箱线图下方都有属性标签(不是当前整数)。

显示属性分布的箱形图

sns.boxplot(data=[df['mi'],df['steps'],df['Standing time'],df['lying time']])

box plot by scale 1

您可以通过使用列名列表进行索引来对 pandas DataFrame 进行子集化

sns.boxplot(data=df[['mi', 'steps', 'Standing time', 'lying time']])