I have this code.
l = df.columns.values
number_of_columns=5
number_of_rows = len(l)-1/number_of_columns
plt.figure(figsize=(number_of_columns * 2, 5*number_of_rows))
for i in range(0,len(l)):
plt.subplot(number_of_rows 1, number_of_columns, i 1)
sns.set_style('whitegrid')
sns.boxplot(data=df[l[i]], color='green', orient='v')
plt.tight_layout()
This is the output.
I want the output to display the column/feature name like the following image.
Can someone tell me how to do that?
Thanks
CodePudding user response:
You should collect the axis
object returned by sns.boxplot
and add a name to its y-axis:
#...
ax = sns.boxplot(data=df[l[i]], color='green', orient='v')
ax.set_ylabel(df.columns[i])
#...