如何将第一个条与x标签CI对齐?太离谱了。为了更加挑剔,其余的酒吧也向右移动。我怎样才能将它们全部集中在一起?
我的代码如下所示:
colors = ["coral", "sea blue"]
g = sns.FacetGrid(data=c_obs_00_pd, size=7, aspect=1.5)
g.map(sns.barplot, "Name", '% of Significant T Test', "Location", palette=sns.xkcd_palette(colors), order=['CI', '20%, Small', '20%, Large', '50%, Small', '50%, Large'])
g.map(plt.axhline, y=5.6, color="k", ls='--', lw="3")
loading_patch = mpl.patches.Patch(color='#fc5a50', label='Loading')
threshold_patch = mpl.patches.Patch(color='#047495', label='Threshold')
plt.legend(handles=[loading_patch, threshold_patch], loc='upper left', ncol=1, fontsize=14)
plt.title("Cancelout Simulation", fontsize=18)
plt.ylabel("Percent of Significant t-Tests", fontsize=18, labelpad=25)
plt.xlabel("Conditions - Latent Means Simulated as Equal", fontsize=18, labelpad=20)
plt.grid(b=True, which='minor', color='k', axis='y', linestyle='-', alpha=0.1)
plt.tick_params(axis='both', which='major', labelsize=16)
plt.minorticks_on()
plt.savefig('Cancelout-% of Sig t-Test in Equal Latent Mean.png', dpi=75)
答案 0 :(得分:1)
如评论中所示,条形图偏离中心的原因是因为您有一个色调级别未在图中显示,即最左边的条形图中没有数据。