Skip to content

Commit 7271035

Browse files
authored
Avoid exception from Continuous scale for normed property (#3190)
1 parent 4a9e549 commit 7271035

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

doc/whatsnew/v0.12.2.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ v0.12.2 (Unreleased)
1414

1515
- |Fix| Fixed a regression in v0.12.0 where manually-added labels could have duplicate legend entries (:pr:`3116`).
1616

17+
- |Fix| Normed properties using a :class:`objects.Continuous` scale no longer raise on boolean data (:pr:`3189`).
18+
1719
- |Fix| Fixed a bug in :func:`histplot` with `kde=True` and `log_scale=True` where the curve was not scaled properly (:pr:`3173`).
1820

1921
- |Fix| Fixed a bug in :func:`relplot` where inner axis labels would be shown when axis sharing was disabled (:pr:`3180`).

seaborn/_core/scales.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ def _setup(
346346
vmin, vmax = data.min(), data.max()
347347
else:
348348
vmin, vmax = new.norm
349-
vmin, vmax = axis.convert_units((vmin, vmax))
349+
vmin, vmax = map(float, axis.convert_units((vmin, vmax)))
350350
a = forward(vmin)
351351
b = forward(vmax) - forward(vmin)
352352

tests/_core/test_scales.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ def test_interval_with_range_norm_and_transform(self, x):
9090
s = Continuous((2, 3), (10, 100), "log")._setup(x, IntervalProperty())
9191
assert_array_equal(s(x), [1, 2, 3])
9292

93+
def test_interval_with_bools(self):
94+
95+
x = pd.Series([True, False, False])
96+
s = Continuous()._setup(x, IntervalProperty())
97+
assert_array_equal(s(x), [1, 0, 0])
98+
9399
def test_color_defaults(self, x):
94100

95101
cmap = color_palette("ch:", as_cmap=True)

0 commit comments

Comments
 (0)