I've been trying to plot multiple graphs using a for loop and seaborn. Have tried different approaches (with subplots and trying to display them sequentially) and I can't manage to get the all the graphs to display (the best I've achieved is plotting the last one in the list). Here are the two approaches I've tried:
fig, ax = plt.subplots(1, 3, sharex = True) #Just hardcoding thre 3 here (number of slicers to plot) for testing
for i, col in enumerate(slicers):
plt.sca(ax[i])
ax[i] = sns.catplot(x = 'seq', kind = 'count', hue = col
, order = dfFirst['seq'].value_counts().index, height=6, aspect=11.7/6
, data = dfFirst) # distribution.set_xticklabels(rotation=65, horizontalalignment='right')
display(fig)
Have tried all combinations between plt.sca(ax[i]) and ax[i] = sns.catplot (activating both as in the example and one at a time) but fig always shows empty when displaying. In addition, I tried displaying figures sequentially using:
for i, col in enumerate(slicers):
plt.figure(i)
sns.catplot(x = 'seq', kind = 'count', hue = col
, order = dfFirst['seq'].value_counts().index, height=6, aspect=11.7/6
, data = dfFirst) # distribution.set_xticklabels(rotation=65, horizontalalignment='right')
display(figure)