Skip to content

STY: set all artists in boxplots to same zorder #6766

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 8, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3537,6 +3537,8 @@ def bxp(self, bxpstats, positions=None, widths=None, vert=True,
'dotted': ':'
}

zorder = mlines.Line2D.zorder
zdelta = 0.1
# 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 + zdelta
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 + zdelta
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