Most of the examples I found use Pandas DataFrame in order to have multiple boxes in a single box plot. I would like to know if there is a simpler, more straight forward way by directly using numpy arrays as the input.
For example, let's take five numpy arrays with each one of them having 20 entries. I would like to plot those five arrays as individual blocks next to each. The block should illustrate the variance of the array entries.
The end result should look something like the second picture on Seaborn's page.
Simply pass a list of numpy arrays into seaborn's boxplot
as it mentions from your very link, the data argument can consist of:
data : DataFrame, array, or list of arrays, optional
import numpy as np
import seaborn as sns
np.random.seed(111)
all_arr = [np.random.uniform(size=20),
np.random.uniform(size=20),
np.random.uniform(size=20),
np.random.uniform(size=20),
np.random.uniform(size=20)]
sns.boxplot(data=all_arr)
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