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

Skip to content

Commit 813e41a

Browse files
kidkoder432QuLogic
andauthored
Boxplot fix median line extending past box boundaries (#26462)
Closes #19409. - Set the default capstyles (solid and dashed) for median and mean lines in boxplots to "butt". I also modieifed the behaviror for setting the capstyle for median lines to obey the user's preference instead of overriding it. - The boxplot PDFs were using the wrong capstyle, so I modified the references to use the butt captyle. - Fixed a small typo in `bxp()` - Added a new test for the median line (from PR #23335) Co-authored-by: Elliott Sales de Andrade <[email protected]>
1 parent db533bf commit 813e41a

37 files changed

+21
-1
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4095,7 +4095,7 @@ def bxp(self, bxpstats, positions=None, widths=None, vert=True,
40954095
40964096
capwidths : float or array-like, default: None
40974097
Either a scalar or a vector and sets the width of each cap.
4098-
The default is ``0.5*(with of the box)``, see *widths*.
4098+
The default is ``0.5*(width of the box)``, see *widths*.
40994099
41004100
vert : bool, default: True
41014101
If `True` (default), makes the boxes vertical.
@@ -4147,6 +4147,17 @@ def bxp(self, bxpstats, positions=None, widths=None, vert=True,
41474147
--------
41484148
.. plot:: gallery/statistics/bxp.py
41494149
"""
4150+
# Clamp median line to edge of box by default.
4151+
medianprops = {
4152+
"solid_capstyle": "butt",
4153+
"dash_capstyle": "butt",
4154+
**(medianprops or {}),
4155+
}
4156+
meanprops = {
4157+
"solid_capstyle": "butt",
4158+
"dash_capstyle": "butt",
4159+
**(meanprops or {}),
4160+
}
41504161

41514162
# lists of artists to be output
41524163
whiskers = []
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)