Skip to content

Commit

Permalink
STY: set all artists in boxplots to same zorder
Browse files Browse the repository at this point in the history
  • Loading branch information
tacaswell committed Jul 16, 2016
1 parent a61f763 commit a6891a9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/matplotlib/axes/_axes.py
Expand Up @@ -3537,6 +3537,8 @@ def bxp(self, bxpstats, positions=None, widths=None, vert=True,
'dotted': ':'
}

zorder = mlines.Line2D.zorder

# box properties
if patch_artist:
final_boxprops = dict(
Expand All @@ -3553,6 +3555,7 @@ def bxp(self, bxpstats, positions=None, widths=None, vert=True,
color=rcParams['boxplot.boxprops.color'],
)

final_boxprops['zorder'] = zorder
if boxprops is not None:
final_boxprops.update(boxprops)

Expand All @@ -3569,9 +3572,11 @@ def bxp(self, bxpstats, positions=None, widths=None, vert=True,
color=rcParams['boxplot.capprops.color'],
)

final_capprops['zorder'] = zorder
if capprops is not None:
final_capprops.update(capprops)

final_whiskerprops['zorder'] = zorder
if whiskerprops is not None:
final_whiskerprops.update(whiskerprops)

Expand All @@ -3586,6 +3591,7 @@ def bxp(self, bxpstats, positions=None, widths=None, vert=True,
markersize=rcParams['boxplot.flierprops.markersize'],
)

final_flierprops['zorder'] = zorder
# flier (outlier) properties
if flierprops is not None:
final_flierprops.update(flierprops)
Expand All @@ -3596,6 +3602,7 @@ def bxp(self, bxpstats, positions=None, widths=None, vert=True,
linewidth=rcParams['boxplot.medianprops.linewidth'],
color=rcParams['boxplot.medianprops.color'],
)
final_medianprops['zorder'] = zorder
if medianprops is not None:
final_medianprops.update(medianprops)

Expand All @@ -3614,13 +3621,14 @@ def bxp(self, bxpstats, positions=None, widths=None, vert=True,
markeredgecolor=rcParams['boxplot.meanprops.markeredgecolor'],
markersize=rcParams['boxplot.meanprops.markersize'],
)
final_meanprops['zorder'] = zorder
if meanprops is not None:
final_meanprops.update(meanprops)

def to_vc(xs, ys):
# convert arguments to verts and codes
verts = []
#codes = []

for xi, yi in zip(xs, ys):
verts.append((xi, yi))
verts.append((0, 0)) # ignored
Expand Down

0 comments on commit a6891a9

Please sign in to comment.