Skip to content

Commit

Permalink
Slight rearrangement of PairGrid variable processing
Browse files Browse the repository at this point in the history
  • Loading branch information
mwaskom committed Dec 12, 2020
1 parent ee78116 commit 7d9bf0b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions seaborn/axisgrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -1161,20 +1161,20 @@ def __init__(
if y_vars is None:
y_vars = numeric_cols

if not len(x_vars):
raise ValueError("No numeric variables found in for grid columns.")
if not len(y_vars):
raise ValueError("No numeric variables found for grid rows.")

if np.isscalar(x_vars):
x_vars = [x_vars]
if np.isscalar(y_vars):
y_vars = [y_vars]

self.x_vars = list(x_vars)
self.y_vars = list(y_vars)
self.x_vars = x_vars = list(x_vars)
self.y_vars = y_vars = list(y_vars)
self.square_grid = self.x_vars == self.y_vars

if not x_vars:
raise ValueError("No variables found for grid columns.")
if not y_vars:
raise ValueError("No variables found for grid rows.")

# Create the figure and the array of subplots
figsize = len(x_vars) * height * aspect, len(y_vars) * height

Expand Down
2 changes: 1 addition & 1 deletion seaborn/tests/test_axisgrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ def test_size(self):

def test_empty_grid(self):

with pytest.raises(ValueError, match="No numeric variables"):
with pytest.raises(ValueError, match="No variables found"):
ag.PairGrid(self.df[["a", "b"]])

def test_map(self):
Expand Down

0 comments on commit 7d9bf0b

Please sign in to comment.