-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
Boxplot: Median line too long after changing linewidth #19409
Copy link
Copy link
Closed
Labels
Difficulty: Easyhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issueshttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issuesGood first issueOpen a pull request against these issues if there are no active ones!Open a pull request against these issues if there are no active ones!
Milestone
Metadata
Metadata
Assignees
Labels
Difficulty: Easyhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issueshttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issuesGood first issueOpen a pull request against these issues if there are no active ones!Open a pull request against these issues if there are no active ones!
Type
Fields
Give feedbackNo fields configured for issues without a type.
When changing the
linewidthproperty of the median line in boxplots, the line will extend beyond the box width.For example,
gives (on Matplotlib 3.2.2):

By simply chaning the
solid_capstylepropery to"butt"inI was able to improve this a bit (I stole that trick from here):

Ideally, one could now reduce the median line length such that it no longer overlaps with the black bounding line of the box.
Since the box line width is only accessible in "points" units, it would need to be transformed to data units.
I was unable to get this to work, though.
Would it be possible/desirable to change the default setting for
solid_capstyle?Could this be handled in a different way?