I have a dataframe with 150 columns and 800 rows. Each row represents a sample, which belongs to one of 5 classes. Therefore all samples are pre-classified. I need to create 150 boxplot charts, one for each column (variable), showing the distribution of the data between the classes, for that variable.
I managed to build a code to generate the graphs, but I have to adjust by hand each of the 150 lines to indicate the location of the graph, which is a sequence [0,0], [0,1], [0,2], [1,0], [1,1], [1,2] etc., as well as the y, which could come from a list, but I don't know how to do this.
Below is an example of how it looks like. The first 9 I did by hand, but to do the other 150 would be a lot of work. It should be possible to automate this, I think, but I don't know how. Does anyone have an idea?
fig, axes = plt.subplots(3, 3, figsize=(18, 12)) fig.suptitle('SAPIENS BOXPLOTS') sns.boxplot(ax=axes[0, 0], data=sapiens, x='classe', y='meanB0') sns.boxplot(ax=axes[0, 1], data=sapiens, x='classe', y='meanB1') sns.boxplot(ax=axes[0, 2], data=sapiens, x='classe', y='meanB2') sns.boxplot(ax=axes[1, 0], data=sapiens, x='classe', y='meanB3') sns.boxplot(ax=axes[1, 1], data=sapiens, x='classe', y='meanB4') sns.boxplot(ax=axes[1, 2], data=sapiens, x='classe', y='varB0') sns.boxplot(ax=axes[2, 0], data=sapiens, x='classe', y='varB1') sns.boxplot(ax=axes[2, 1], data=sapiens, x='classe', y='varB2') sns.boxplot(ax=axes[2, 2], data=sapiens, x='classe', y='varB3') 
