I have a two boxplotes
a1=a[['kCH4_sync','week_days']]
a1.boxplot(by = 'week_days', meanline=True, showmeans=True, showcaps=True, showbox=True,
showfliers=False)
a2=a[['CH4_sync','week_days']]
a2.boxplot(by = 'week_days', meanline=True, showmeans=True, showcaps=True, showbox=True,
showfliers=False)
But I want to place them in one graph to compare them. Have you any advice to solve this problem? Thanks!
In this article, we will learn how to plot multiple boxplot in one graph in R Programming Language. This can be accomplished by using boxplot() function, and we can also pass in a list, data frame or multiple vectors to it. For this purpose, we need to put name of data into boxplot() function as input.
Creating Box PlotThe matplotlib. pyplot module of matplotlib library provides boxplot() function with the help of which we can create box plots. The data values given to the ax. boxplot() method can be a Numpy array or Python list or Tuple of arrays.
To plot multiple boxplots on one matplotlib graph you can pass a list of data arrays to boxplot, as in:
import numpy as np
import matplotlib.pyplot as plt
x1 = 10*np.random.random(100)
x2 = 10*np.random.exponential(0.5, 100)
x3 = 10*np.random.normal(0, 0.4, 100)
plt.boxplot ([x1, x2, x3])
The only thing I am not sure of is if you want each boxplot to have a different color etc. Generally it won't plot in different colour
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With