From 297945c111ed6c242b24354bc8965f905a54afde Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Sat, 16 Jul 2016 16:36:15 -0500 Subject: [PATCH] STY: set all artists in boxplots to same zorder Add a small delta to the mean and median lines to ensure that they are on top. closes #6510 --- lib/matplotlib/axes/_axes.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 921963c590b3..f2a95ab1d992 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -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( @@ -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) @@ -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) @@ -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) @@ -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) @@ -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 pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy