Skip to content

Commit

Permalink
Avoid exception from Continuous scale for normed property (#3190)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwaskom authored Dec 28, 2022
1 parent 4a9e549 commit 7271035
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions doc/whatsnew/v0.12.2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ v0.12.2 (Unreleased)

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

- |Fix| Normed properties using a :class:`objects.Continuous` scale no longer raise on boolean data (:pr:`3189`).

- |Fix| Fixed a bug in :func:`histplot` with `kde=True` and `log_scale=True` where the curve was not scaled properly (:pr:`3173`).

- |Fix| Fixed a bug in :func:`relplot` where inner axis labels would be shown when axis sharing was disabled (:pr:`3180`).
2 changes: 1 addition & 1 deletion seaborn/_core/scales.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ def _setup(
vmin, vmax = data.min(), data.max()
else:
vmin, vmax = new.norm
vmin, vmax = axis.convert_units((vmin, vmax))
vmin, vmax = map(float, axis.convert_units((vmin, vmax)))
a = forward(vmin)
b = forward(vmax) - forward(vmin)

Expand Down
6 changes: 6 additions & 0 deletions tests/_core/test_scales.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ def test_interval_with_range_norm_and_transform(self, x):
s = Continuous((2, 3), (10, 100), "log")._setup(x, IntervalProperty())
assert_array_equal(s(x), [1, 2, 3])

def test_interval_with_bools(self):

x = pd.Series([True, False, False])
s = Continuous()._setup(x, IntervalProperty())
assert_array_equal(s(x), [1, 0, 0])

def test_color_defaults(self, x):

cmap = color_palette("ch:", as_cmap=True)
Expand Down

0 comments on commit 7271035

Please sign in to comment.