title: Hide non observed categories in a seaborn boxplot
body: <p>I am currently working on a data analysis, and want to show some data distributions through seaborn boxplots.</p>
  <p>I have a categorical data, 'seg1' which can in my dataset take 3 values ('Z1', 'Z3', 'Z4'). However, data in group 'Z4' is too exotic to be reported for me, and I would like to produce boxplots showing only categories 'Z1' and 'Z3'.</p>
  <p>Filtering the data source of the plot did not work, as category 'Z4' is still showed with no data point.</p>
  <p>Is there any other solution than having to create a new <code>CategoricalDtype</code> with only ('Z1', 'Z3') and cast/project my data back on this new category?</p>
  <p>I would simply like to hide 'Z4' category.</p>
  <p>I am using seaborn 0.10.1 and matplotlib 3.3.1.</p>
  <p>Thanks in advance for your answers.</p>
  <p>My tries are below, and some data to reproduce.</p>
  <p><strong>Dummy data</strong></p>
  <pre class="lang-py prettyprint-override"><code>dummy_cat = pd.CategoricalDtype(['a', 'b', 'c'])
  df = pd.DataFrame({'col1': ['a', 'b', 'a', 'b'], 'col2': [12., 5., 3., 2]})
  df.col1 = df.col1.astype(dummy_cat)
  sns.boxplot(data=df, x='col1', y='col2')
  </code></pre>
  <p><a href="https://i.stack.imgur.com/0YYva.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0YYva.png" alt="dummy data" /></a></p>
  <p><strong>Apply no filter</strong></p>
  <pre class="lang-py prettyprint-override"><code>fig, axs = plt.subplots(figsize=(8, 25), nrows=len(indicators2), squeeze=False)
  for j, indicator in enumerate(indicators2):
      sns.boxplot(data=orders, y=indicator, x='seg1', hue='origin2', ax=axs[j, 0], showfliers=False)
  </code></pre>
  <p>Which produces:</p>
  <p><a href="https://i.stack.imgur.com/Nnr4v.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Nnr4v.png" alt="Non filtered data" /></a></p>
  <p><strong>Filter data source</strong></p>
  <pre class="lang-py prettyprint-override"><code>mask_filter = orders.seg1.isin(['Z1', 'Z3'])
  
  fig, axs = plt.subplots(figsize=(8, 25), nrows=len(indicators2), squeeze=False)
  for j, indicator in enumerate(indicators2):
      sns.boxplot(data=orders.loc[mask_filter], y=indicator, x='seg1', hue='origin2', ax=axs[j, 0], showfliers=False)
  
  </code></pre>
  <p>Which produces:</p>
  <p><a href="https://i.stack.imgur.com/tzl3p.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tzl3p.png" alt="Filter data source" /></a></p>