This pull request addresses two issues in the plot_paired function related to the boxplot_in_front parameter:
Incorrect behavior when boxplot_in_front=False: the boxplot was being drawn above the lines and markers even when this parameter was set to False, contradicting its intended functionality.
Boxplot disappearance when boxplot_in_front=False after initial fix: an earlier attempt to fix the first issue resulted in the boxplot disappearing completely because its z-order was set too low.
The first issue stemmed from a lack of explicit z-order control for the boxplot elements when boxplot_in_front was False. This allowed Matplotlib's default drawing order to take over, potentially placing the boxplot on top regardless of the user's intent.
The second issue arose because the z-order of the boxplot was set lower than the lines and markers, causing them to obscure the boxplot entirely.
Solution:
The fix involves:
Introducing explicit z-order control for the boxplot elements in both branches of the conditional statement.
Setting appropriate z-orders to ensure correct layering:
When boxplot_in_front=True, the boxplot has a z-order of 3 (on top).
When boxplot_in_front=False, the boxplot has a z-order of 1 (behind).
The lines and markers maintain their default z-order of 2.
Impact:
This change ensures that the boxplot_in_front parameter functions correctly and consistently, providing users with accurate control over the visual layering of plot elements in plot_paired.
Testing:
Thorough testing has been conducted with various combinations of boxplot_in_front and other plot settings to confirm the desired behavior and absence of any regressions. You can use the snippet below for testings.
Description:
This pull request addresses two issues in the
plot_paired
function related to theboxplot_in_front
parameter:boxplot_in_front=False
: the boxplot was being drawn above the lines and markers even when this parameter was set toFalse
, contradicting its intended functionality.boxplot_in_front=False
after initial fix: an earlier attempt to fix the first issue resulted in the boxplot disappearing completely because its z-order was set too low.Root Cause:
boxplot_in_front
wasFalse
. This allowed Matplotlib's default drawing order to take over, potentially placing the boxplot on top regardless of the user's intent.Solution:
The fix involves:
boxplot_in_front=True
, the boxplot has a z-order of 3 (on top).boxplot_in_front=False
, the boxplot has a z-order of 1 (behind).Impact:
This change ensures that the
boxplot_in_front
parameter functions correctly and consistently, providing users with accurate control over the visual layering of plot elements inplot_paired
.Testing:
Thorough testing has been conducted with various combinations of
boxplot_in_front
and other plot settings to confirm the desired behavior and absence of any regressions. You can use the snippet below for testings.Please review and merge if you find this fix suitable.
Merci Raphael ;-)