我有一个任务来复制在R中使用其他数据集在python中创建的图形。不幸的是,我们没有最初用于创建图形的R代码,但是下面有一个很好的近似匹配。我正在尝试回答以下问题:
这是旧人物:
这是我用不同数据创建的一个:
这是我用来创建它的代码:
fig, (ax1, ax2, ax3, ax4) = plt.subplots(1, 4, figsize=(8,5), sharey=True)
sns.barplot(data=mean_df[mean_df['DV/CS']=='vag'][mean_df['CON/EVC']=='con'], x='Day',y='day',
ax=ax1, capsize=.1, palette=['#C4C4C4','#C4C4C4'], edgecolor='#6C6C6C', linewidth='3',
errcolor='#6C6C6C')
ax1.set_ylabel('Mean weighted UniFrac distance', size=15)
sns.barplot(data=mean_df[mean_df['DV/CS']=='vag'][mean_df['CON/EVC']=='imp'], x='Day',y='day',
ax=ax2, capsize=.1, palette=['#C1DBD8','#C1DBD8'], edgecolor='#439A89', linewidth='3',
errcolor='#439A89')
sns.barplot(data=mean_df[mean_df['DV/CS']=='csec'][mean_df['CON/EVC']=='con'], x='Day',y='day',
ax=ax3, capsize=.1, palette=['#C4C4C4','#C4C4C4'], edgecolor='#6C6C6C', linewidth='3',
errcolor='#6C6C6C')
sns.barplot(data=mean_df[mean_df['DV/CS']=='csec'][mean_df['CON/EVC']=='imp'], x='Day',y='day',
ax=ax4, capsize=.1, palette=['#C1DBD8','#C1DBD8'], edgecolor='#439A89', linewidth='3',
errcolor='#439A89')
for ax in [ax1, ax2, ax3, ax4]:
ax.set_xticklabels(ax.get_xticklabels(), size=15)
ax.set_xlabel('')
ax.spines['right'].set_visible(False)
ax.spines['top'].set_visible(False)
if ax!=ax1:
ax.set_ylabel('')
ax.spines['left'].set_visible(False)
ax.set_yticks([])
plt.tight_layout()
plt.show()