Reputation: 131
I want to plot boxplots for each of the dataframes side by side. Below is an example dataset.
data 1 :
1 | A | ACTIVE | 12
2 | B | INACTIVE| 10
3 | C | ACTIVE| 9
data 2:
id | type | activity | feature1
1 | A | ACTIVE | 13
2 | B | INACTIVE | 14
3 | C | ACTIVE | 15
First boxplot should be to plot the feature1 grouped by type and the second boxplot should be to plot the feature1 grouped by activity.Both the plots should be placed in the same figure. Note : I do not want to do combined grouping.
Upvotes: 0
Views: 887
Reputation: 2847
Use return_type='axes'
to get data1.boxplot
to return a matplotlib
Axes object. Then pass that axes to the second call to boxplot
using ax=ax
. This will cause both boxplots to be drawn on the same axes.
Alternatively if you just want them plotted side to side use matplotlib subplot
Upvotes: 0