xjackx
xjackx

Reputation: 99

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

I would like to create two boxplots to visualize different attributes within my data by splitting the attributes up based on their scale. I currently have this

box plots to show the distributions of attributes

sns.boxplot(data=df)

box plot with all attributes included

I would like it to be like the images below with the attributes in different box plots based on their scale but with the attribute labels below each boxplot (not the current integers).

box plots to show the distributions of attributes

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

box plot by scale 1

Upvotes: 1

Views: 3133

Answers (1)

mwaskom
mwaskom

Reputation: 49022

You can subset a pandas DataFrame by indexing with a list of column names

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

Upvotes: 2

Related Questions