Skip to content

Commit e4f6186

Browse files
author
leoluecken
committed
Rejecting parameter 'positions' for boxplot(), refs #3566
1 parent 9a2196d commit e4f6186

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

seaborn/categorical.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1577,6 +1577,10 @@ def boxplot(
15771577
fliersize=None, hue_norm=None, native_scale=False, log_scale=None, formatter=None,
15781578
legend="auto", ax=None, **kwargs
15791579
):
1580+
1581+
if "positions" in kwargs:
1582+
msg = "boxplot() does not support parameter 'positions'. Consider to use native_scale=True and specify positions via parameter 'x'."
1583+
raise ValueError(msg)
15801584

15811585
p = _CategoricalPlotter(
15821586
data=data,

tests/test_categorical.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1168,7 +1168,25 @@ def test_vs_catplot(self, long_df, wide_df, null_df, flat_series, kwargs):
11681168
g = catplot(**kwargs, kind="box")
11691169

11701170
assert_plots_equal(ax, g.ax)
1171-
1171+
1172+
1173+
@pytest.mark.parametrize("positions", [None, [1, 2, 3, 4]])
1174+
def test_reject_boxpositions(self, positions):
1175+
1176+
kwargs = {
1177+
"x":[1, 2, 3, 4],
1178+
"y":[1, 1, 2, 2]
1179+
}
1180+
1181+
try:
1182+
boxplot(**kwargs, positions=positions)
1183+
err = None
1184+
except ValueError as e:
1185+
err = e
1186+
1187+
assert(err is not None)
1188+
1189+
11721190

11731191
class TestBoxenPlot(SharedAxesLevelTests, SharedPatchArtistTests):
11741192

0 commit comments

Comments
 (0)