简体   繁体   中英

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?

-- EDIT: Data is available here: 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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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