Home > Software design >  Create a Single Boxplot from Multiple DataFrames
Create a Single Boxplot from Multiple DataFrames

Time:08-30

I have multiple data frames with different no. of rows and same no.of columns i.e

female_df1
ID, Value
5, 85
21, 56.7
17, 77.9

female_df2
ID, Value
75, 39
1, 66.7
7, 67.9

female_df3
ID, Value
5, 85
21, 56.7
17, 77.9

femaledf4
ID, Value
5, 85
21, 56.7
17, 77.9

Now, I would like to plot a single boxplot from above multiple df's. I used below code to do so

fig, ax2 = plt.subplots(figsize = (15,10))
vec = [female_df1['value'].values,female_df2['value'].values,female_df3['value'].values,female_df4['value'].values]
labels = ['f1','f2','f3', 'f4']
ax2.boxplot(vec, labels = labels)
plt.show()

The Output in enter image description here

  • Related