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()
;