<p dir="auto">It would be great to have a numerical dodge option for boxplot that matches the behaviour of pointplot.<br>
This would allow boxplots over violin plots:<br>
<a href="https://discourse.matplotlib.org/t/boxplots-on-top-of-violinplots/22807" rel="nofollow">https://discourse.matplotlib.org/t/boxplots-on-top-of-violinplots/22807</a></p>
<p dir="auto">Hi,</p>
<p dir="auto">thanks for the seaborn library, it's a great tool!</p>
<p dir="auto">I'd like to suggest an aesthetic improvement: A configurable gap between boxes inside a group of boxes: <a target="_blank" rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/6ea6e59392a52550426c6a39b1d0379f7316b495c6bfdbf16a4d40c05313d832/68747470733a2f2f696d6167652e6962622e636f2f65714b3273792f736561626f726e5f626f78706c6f745f6761702e706e67"><img src="https://camo.githubusercontent.com/6ea6e59392a52550426c6a39b1d0379f7316b495c6bfdbf16a4d40c05313d832/68747470733a2f2f696d6167652e6962622e636f2f65714b3273792f736561626f726e5f626f78706c6f745f6761702e706e67" alt="Boxplot with Gap" data-canonical-src="https://image.ibb.co/eqK2sy/seaborn_boxplot_gap.png" style="max-width: 100%;"></a></p>
<p dir="auto">Since I'm currently writing my thesis, I'm a bit short on time, all I've got for now is a patch. If you consider this feature worthwhile, I'd create a proper pull request, of course.</p>
<div class="highlight highlight-source-diff notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="Index: categorical.py
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
&lt;+&gt;UTF-8
===================================================================
--- categorical.py	(date 1528960332000)
+++ categorical.py	(date 1528960332000)
@@ -366,6 +366,7 @@
         n_levels = len(self.hue_names)
         if self.dodge:
-            each_width = self.width / n_levels
+            each_width = (self.width - (self.gap * (n_levels - 1))) / n_levels
             offsets = np.linspace(0, self.width - each_width, n_levels)
             offsets -= offsets.mean()
         else:
@@ -436,13 +437,14 @@
 
     def __init__(self, x, y, hue, data, order, hue_order,
                  orient, color, palette, saturation,
-                 width, dodge, fliersize, linewidth):
+                 width, gap, dodge, fliersize, linewidth):
 
         self.establish_variables(x, y, hue, data, orient, order, hue_order)
         self.establish_colors(color, palette, saturation)
 
         self.dodge = dodge
         self.width = width
+        self.gap = gap
         self.fliersize = fliersize
 
         if linewidth is None:
@@ -2203,12 +2205,12 @@
 
 def boxplot(x=None, y=None, hue=None, data=None, order=None, hue_order=None,
             orient=None, color=None, palette=None, saturation=.75,
-            width=.8, dodge=True, fliersize=5, linewidth=None,
+            width=.8, gap=0.1, dodge=True, fliersize=5, linewidth=None,
             whis=1.5, notch=False, ax=None, **kwargs):
 
     plotter = _BoxPlotter(x, y, hue, data, order, hue_order,
                           orient, color, palette, saturation,
-                          width, dodge, fliersize, linewidth)
+                          width, gap, dodge, fliersize, linewidth)
 
     if ax is None:
         ax = plt.gca()"><pre class="notranslate">Index: categorical.py
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
&lt;+&gt;UTF-8
<span class="pl-ms">===================================================================</span>
<span class="pl-md">--- categorical.py	(date 1528960332000)</span>
<span class="pl-mi1">+++ categorical.py	(date 1528960332000)</span>
<span class="pl-mdr">@@ -366,6 +366,7 @@</span>
         n_levels = len(self.hue_names)
         if self.dodge:
<span class="pl-md"><span class="pl-md">-</span>            each_width = self.width / n_levels</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>            each_width = (self.width - (self.gap * (n_levels - 1))) / n_levels</span>
             offsets = np.linspace(0, self.width - each_width, n_levels)
             offsets -= offsets.mean()
         else:
<span class="pl-mdr">@@ -436,13 +437,14 @@</span>
 
     def __init__(self, x, y, hue, data, order, hue_order,
                  orient, color, palette, saturation,
<span class="pl-md"><span class="pl-md">-</span>                 width, dodge, fliersize, linewidth):</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>                 width, gap, dodge, fliersize, linewidth):</span>
 
         self.establish_variables(x, y, hue, data, orient, order, hue_order)
         self.establish_colors(color, palette, saturation)
 
         self.dodge = dodge
         self.width = width
<span class="pl-mi1"><span class="pl-mi1">+</span>        self.gap = gap</span>
         self.fliersize = fliersize
 
         if linewidth is None:
<span class="pl-mdr">@@ -2203,12 +2205,12 @@</span>
 
 def boxplot(x=None, y=None, hue=None, data=None, order=None, hue_order=None,
             orient=None, color=None, palette=None, saturation=.75,
<span class="pl-md"><span class="pl-md">-</span>            width=.8, dodge=True, fliersize=5, linewidth=None,</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>            width=.8, gap=0.1, dodge=True, fliersize=5, linewidth=None,</span>
             whis=1.5, notch=False, ax=None, **kwargs):
 
     plotter = _BoxPlotter(x, y, hue, data, order, hue_order,
                           orient, color, palette, saturation,
<span class="pl-md"><span class="pl-md">-</span>                          width, dodge, fliersize, linewidth)</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>                          width, gap, dodge, fliersize, linewidth)</span>
 
     if ax is None:
         ax = plt.gca()</pre></div>
<p dir="auto">Please let me know what you think.</p>
<p dir="auto">Cheers,<br>
Peter</p>