1

I am been using the following code to create multiple Violin Charts, however, testing with different datasets I always received half of the charts, any suggestion to fix?

for i,feature in enumerate(selected_vars):
plt.subplots(numvar,2,i+1,figsize=(15,5*numvar))
sns.violinplot(x = z0.clusters, y = z0.loc[:,selected_vars.pop(i-1)], palette="Set2")
plt.xlabel("Cluster")
plt.ylabel(feature)    
;

I even created a more advanced version:

fig, axes = plt.subplots(nrows=numvar, ncols=2, sharex=True, sharey=True, figsize=(15,5*numvar))
axes_list = [item for sublist in axes for item in sublist] 
for i,feature in enumerate(selected_vars):
    ax = axes_list.pop(0)
    plt.subplot(numvar,2,i+1)
    i=i-1
    sns.violinplot(x = z0.clusters, y = z0.loc[:,selected_vars.pop(i)], palette="Set2")
    plt.xlabel("Cluster")
    ax.set_xlabel("")
    plt.ylabel(feature)
for ax in axes_list:
    ax.remove()
;
  • Since you are new to this site, please take a moment to read [How do I ask a good question?](https://stackoverflow.com/help/how-to-ask). Please provide a [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) that include a toy dataset [How to make good reproducible pandas examples](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples) – Diziet Asahi Dec 09 '19 at 09:57

0 Answers0