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

Changing width of bars created with catplot or barplot

In my case, I didn’t have to define a custom function to change the width as suggested above (which btw didn’t work for me as all the bars were unaligned). I simply added the attribute dodge=False to the argument of the seaborn plotting function and this made the trick! e.g. sns.countplot(x=’x’, hue=”y”, data=data, dodge=False); See … Read more