Skip to content

Commit 7296bcf

Browse files
committed
Raise a better error with row and col_wrap
Closes mwaskom#465
1 parent 792950d commit 7296bcf

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

seaborn/axisgrid.py

+3
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,9 @@ def __init__(self, data, row=None, col=None, hue=None, col_wrap=None,
249249

250250
self._col_wrap = col_wrap
251251
if col_wrap is not None:
252+
if row is not None:
253+
err = "Cannot use `row` and `col_wrap` together."
254+
raise ValueError(err)
252255
ncol = col_wrap
253256
nrow = int(np.ceil(len(data[col].unique()) / col_wrap))
254257
self._ncol = ncol

seaborn/tests/test_axisgrid.py

+3
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ def test_col_wrap(self):
104104
nt.assert_equal(g_wrap._ncol, 4)
105105
nt.assert_equal(g_wrap._nrow, 3)
106106

107+
with nt.assert_raises(ValueError):
108+
g = ag.FacetGrid(self.df, row="b", col="d", col_wrap=4)
109+
107110
plt.close("all")
108111

109112
def test_normal_axes(self):

0 commit comments

Comments
 (0)