Plot Sequential Box Plots In Matplotlib (control And Treatment Groups)
I have measurements from control and treatment groups at sequential times, and I would like to plot the box plots of the measurements at each time with the times in order along the
Solution 1:
What you can do is to utilize the by = 'column name' argument to specify by which column you wish to group your data. In addition, passing the column = [column_1, column_2] argument allows you to specify which columns you wish to evaluate against you 'T' variable. The code below creates 2 box plot visualizations for each column (X and G). In both cases, your data is grouped by your desired column 'T'.
# Create boxplots for columns X and G, each grouped by column T
df.boxplot(column = ['X', 'G'], # specify columns you wish to analyze
by = 'T', # specify column by which you wish to group data
vert = False, # specify whethere you want vertical or horizontal output
figsize = (16, 8)) # specify the size of your output# Show the result
plt.show()
The output of the above code will be as follows:
Post a Comment for "Plot Sequential Box Plots In Matplotlib (control And Treatment Groups)"