0

My data has 12 columns. Columns F1, F2, ..., F11) are features. Column 12 contains the label of these features either yes or no.

I would like to plot a boxplot of all these 11 features against the label, but separate by yes or no.

My code so far is:

names=['f1','f2',......'f11']
for i in range(11):
    yes = df[df['class']=='YES'][names[i]]
    no = df[df['class']=='NO'][names[i]]
    fig,axes = plt.subplots(figsize=(8,8))
    bp = axes.boxplot([yes,no], labels=['YES', 'NO'],patch_artist=True)
    for box in bp['boxes']:
        box.set(color='#7570b3', linewidth=2)
        box.set(facecolor = '#FF0000')

My question is: How to show F2, F3, ..., F11 against the label in one graph with some gap in between?

as in the question linked for R (Plot multiple boxplot in one graph)

Coderhhz
  • 320
  • 3
  • 5
  • 15
  • 1
    Please read [How to create a Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) – Sheldore May 22 '19 at 23:41

1 Answers1

0

This might be a possible duplicate of matplotlib analog of R's `pairs`

Here's another choice for you to go about it as well: https://seaborn.pydata.org/generated/seaborn.pairplot.html