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.
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.