From 25f934e4ca008bf20643d717602870b03953be3d Mon Sep 17 00:00:00 2001 From: Behram Mistree Date: Sat, 27 Sep 2014 00:31:04 -0700 Subject: [PATCH 1/2] Previous matplotlib had a bug. As per documentation, specifying empty string for sym argument should prevent drawing fliers for boxplots. As an example, the following script displays fliers in the boxplot when it shouldn't. import matplotlib.pyplot as plt data = list(range(0,100)) + [200,-200,250,-250] bp = plt.boxplot(data,sym='',widths=.3) plt.show() Added logic to ensure empty sym string does not display fliers. --- lib/matplotlib/axes/_axes.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 12f79352a539..9558b3c602f4 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -3081,6 +3081,10 @@ def boxplot(self, x, notch=False, sym=None, vert=True, whis=1.5, flierprops['markeredgecolor'] = color flierprops['markerfacecolor'] = color + # do not show fliers if sym is empty string + if sym == '': + showfliers = False + # replace medians if necessary: if usermedians is not None: if (len(np.ravel(usermedians)) != len(bxpstats) or From 90c516f611b95e83c68b41fcf886e663f4cc1a9f Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Mon, 29 Sep 2014 21:15:36 -0400 Subject: [PATCH 2/2] MNT : minor refactor of patch from bmistree --- lib/matplotlib/axes/_axes.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 9558b3c602f4..9bbda6f62fa5 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -3064,6 +3064,8 @@ def boxplot(self, x, notch=False, sym=None, vert=True, whis=1.5, flierprops = dict(linestyle='none', marker='', markeredgecolor='none', markerfacecolor='none') + # turn the fliers off just to be safe + showfliers = False # now process the symbol string else: # process the symbol string @@ -3081,10 +3083,6 @@ def boxplot(self, x, notch=False, sym=None, vert=True, whis=1.5, flierprops['markeredgecolor'] = color flierprops['markerfacecolor'] = color - # do not show fliers if sym is empty string - if sym == '': - showfliers = False - # replace medians if necessary: if usermedians is not None: if (len(np.ravel(usermedians)) != len(bxpstats) or