title: How to display boxplot in front of violinplot in seaborn - seaborn zorder?
body: <p>To customize the styles of the boxplot displayed inside a violinplot, on could try to plot a boxplot in front of a violinplot. However this does not seem to work as it is always displayed behind the violinplot when using seaborn.</p>
  <p>When using seaborn + matplotlib this works (but only for a single category):</p>
  <pre class="lang-py prettyprint-override"><code>import matplotlib.pyplot as plt
  import seaborn as sns
  import numpy as np
  
  df=pd.DataFrame(np.random.rand(10,2)).melt(var_name='group')
  
  fig, axes = plt.subplots()
  
  # Seaborn violin plot
  sns.violinplot(y=df[df['group']==0]['value'], color=&quot;#af52f4&quot;, inner=None, linewidth=0, saturation=0.5)
  
  # Normal boxplot has full range, same in Seaborn boxplot
  axes.boxplot(df[df['group']==0]['value'], whis='range', positions=np.array([0]),
              showcaps=False,widths=0.06, patch_artist=True,
              boxprops=dict(color=&quot;indigo&quot;, facecolor=&quot;indigo&quot;),
              whiskerprops=dict(color=&quot;indigo&quot;, linewidth=2),
              medianprops=dict(color=&quot;w&quot;, linewidth=2 ))
  
  axes.set_xlim(-1,1)
  
  plt.show()
  </code></pre>
  <p><a href="https://i.stack.imgur.com/0bcCg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0bcCg.png" alt="correctly placed boxplot" /></a></p>
  <p>However when using only seaborn to be able to plot across multiple categories, ordering is always wrong:</p>
  <pre class="lang-py prettyprint-override"><code>sns.violinplot(data=df, x='group', y='value', color=&quot;#af52f4&quot;, inner=None, linewidth=0, saturation=0.5)
  sns.boxplot(data=df, x='group', y='value', saturation=0.5)
  
  
  plt.show()
  
  </code></pre>
  <p><a href="https://i.stack.imgur.com/lt99j.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lt99j.png" alt="incorrectly placed boxplot" /></a></p>
  <p>Even when trying to fix this with <code>zorder</code> this does not work.</p>