简体   繁体   English

如何避免在海洋因子图中没有任何相关数据的情况下显示x轴标签

[英]How to avoid displaying x-axis labels without any associated data in seaborn factorplot

在此处输入图片说明

To make the plot above, I do this: 为了进行以上绘制,我这样做:

import seaborn as sns
g = sns.factorplot('State', ' % Overall Match', hue='experiment', data=df_states, col='percentile', kind='box', col_wrap=2, sharex=False)

Is there a way to NOT display the x-axis labels that do not have nay associated data? 有没有办法不显示不包含相关数据的x轴标签?

-- EDIT: Data is available here: https://www.dropbox.com/s/pn7j95sjjb9n8t0/old_all.csv?dl=0 -编辑:数据在这里可用: https : //www.dropbox.com/s/pn7j95sjjb9n8t0/old_all.csv?dl=0

I think I would do this manually: 我想我会手动执行此操作:

fig, ax_array = plt.subplots(2,2)
axes = ax_array.flatten()

for ax, perc in zip(axes, df_states['percentile'].unique()):
     sns.boxplot('State', ' % Overall Match', hue='experiment',
                 data=df_states[df_states['percentile'] == perc], ax=ax)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM