Skip to content
Advertisement

matplotlib: Group boxplots

Is there a way to group boxplots in matplotlib?

Assume we have three groups “A”, “B”, and “C” and for each we want to create a boxplot for both “apples” and “oranges”. If a grouping is not possible directly, we can create all six combinations and place them linearly side by side. What would be to simplest way to visualize the groupings? I’m trying to avoid setting the tick labels to something like “A + apples” since my scenario involves much longer names than “A”.

Advertisement

Answer

How about using colors to differentiate between “apples” and “oranges” and spacing to separate “A”, “B” and “C”?

Something like this:

JavaScript

grouped box plot

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement