Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ee3d2fb

Browse files
committed
Merge pull request #3600 from phobson/boxplot-flier-artists
BUG : now only set 'marker' and 'color' attribute of fliers in boxplots
1 parent b2b5227 commit ee3d2fb

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3062,8 +3062,7 @@ def boxplot(self, x, notch=False, sym=None, vert=True, whis=1.5,
30623062
if sym == '':
30633063
# blow away existing dict and make one for invisible markers
30643064
flierprops = dict(linestyle='none', marker='',
3065-
markeredgecolor='none',
3066-
markerfacecolor='none')
3065+
color='none')
30673066
# turn the fliers off just to be safe
30683067
showfliers = False
30693068
# now process the symbol string
@@ -3076,12 +3075,10 @@ def boxplot(self, x, notch=False, sym=None, vert=True, whis=1.5,
30763075
flierprops['marker'] = marker
30773076
# if we have a color, use it
30783077
if color is not None:
3079-
flierprops['color'] = color
30803078
# assume that if color is passed in the user want
30813079
# filled symbol, if the users want more control use
30823080
# flierprops
3083-
flierprops['markeredgecolor'] = color
3084-
flierprops['markerfacecolor'] = color
3081+
flierprops['color'] = color
30853082

30863083
# replace medians if necessary:
30873084
if usermedians is not None:
@@ -3320,9 +3317,7 @@ def bxp(self, bxpstats, positions=None, widths=None, vert=True,
33203317
final_whiskerprops.update(whiskerprops)
33213318

33223319
# set up the default flier properties
3323-
final_flierprops = dict(linestyle='none', marker='+',
3324-
markeredgecolor='b',
3325-
markerfacecolor='none')
3320+
final_flierprops = dict(linestyle='none', marker='+', color='blue')
33263321

33273322
# flier (outlier) properties
33283323
if flierprops is not None:

lib/matplotlib/tests/test_axes.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1627,6 +1627,18 @@ def test_boxplot_bad_ci_2():
16271627
conf_intervals=[[1, 2], [1]])
16281628

16291629

1630+
@image_comparison(baseline_images=['boxplot_mod_artists_after_plotting'],
1631+
remove_text=True, extensions=['png'],
1632+
savefig_kwarg={'dpi': 40})
1633+
def test_boxplot_mod_artist_after_plotting():
1634+
x = [0.15, 0.11, 0.06, 0.06, 0.12, 0.56, -0.56]
1635+
fig, ax = plt.subplots()
1636+
bp = ax.boxplot(x, sym="o")
1637+
for key in bp:
1638+
for obj in bp[key]:
1639+
obj.set_color('green')
1640+
1641+
16301642
@image_comparison(baseline_images=['violinplot_vert_baseline'],
16311643
extensions=['png'])
16321644
def test_vert_violinplot_baseline():

0 commit comments

Comments
 (0)