Skip to content

Commit

Permalink
Fix guess_continuous to not assign continuous for string categories (#…
Browse files Browse the repository at this point in the history
…6452)

Ensure that string categories are not treated as continuous.

closes #6433
  • Loading branch information
Czaki committed Nov 20, 2023
1 parent e31f345 commit dbafdd0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions napari/layers/utils/color_manager_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ def guess_continuous(color_map: np.ndarray) -> bool:
True of the property is guessed to be continuous, False if not.
"""
# if the property is a floating type, guess continuous
return (
issubclass(color_map.dtype.type, np.floating)
or len(np.unique(color_map)) > 16
return issubclass(color_map.dtype.type, np.floating) or (
len(np.unique(color_map)) > 16
and isinstance(color_map.dtype.type, np.integer)
)


Expand Down

0 comments on commit dbafdd0

Please sign in to comment.