How to add hatches to boxplots with sns.boxplot or sns.catplot

Iterate through each subplot / FacetGrid with for ax in g.axes.flat:. ax.patches contains matplotlib.patches.Rectangle and matplotlib.patches.PathPatch, so the correct ones must be used. Caveat: all hues must appear for each group in each Facet, otherwise the patches and hatches will not match. In this case, manual or conditional code will probably be required to correctly … Read more

Subplot for seaborn boxplot

We create the figure with the subplots: f, axes = plt.subplots(1, 2) Where axes is an array with each subplot. Then we tell each plot in which subplot we want them with the argument ax. sns.boxplot( y=”b”, x= “a”, data=df, orient=”v” , ax=axes[0]) sns.boxplot( y=”c”, x= “a”, data=df, orient=”v” , ax=axes[1]) And the result is:

Is it possible to draw a boxplot given the percentile values instead of the original inputs?

As of 2020, there is a better method than the one in the accepted answer. The matplotlib.axes.Axes class provides a bxp method, which can be used to draw the boxes and whiskers based on the percentile values. Raw data is only needed for the outliers, and that is optional. Example: import matplotlib.pyplot as plt fig, … Read more

Plotting multiple boxplots in seaborn

Consider first assigning a grouping column like Trial for each corresponding dataframe, then pd.concat your dataframes, and finally pd.melt the data for a indicator/value long-wise dataframe before plotting with seaborn. Below demonstrates with random data: import pandas as pd import numpy as np from matplotlib import pyplot as plt import seaborn as sns np.random.seed(44) # … Read more