Skip to content

Commit

Permalink
fixed #1185, binary colormap (#1186)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmcfee committed Jun 25, 2020
1 parent 6f609e6 commit 3c57f7c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions librosa/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ def cmap(data, robust=True, cmap_seq='magma', cmap_bool='gray_r', cmap_div='cool
data = np.atleast_1d(data)

if data.dtype == 'bool':
return get_cmap(cmap_bool)
return get_cmap(cmap_bool, lut=2)

data = data[np.isfinite(data)]

Expand All @@ -349,8 +349,7 @@ def cmap(data, robust=True, cmap_seq='magma', cmap_bool='gray_r', cmap_div='cool
else:
min_p, max_p = 0, 100

max_val = np.percentile(data, max_p)
min_val = np.percentile(data, min_p)
min_val, max_val = np.percentile(data, [min_p, max_p])

if min_val >= 0 or max_val <= 0:
return get_cmap(cmap_seq)
Expand Down

0 comments on commit 3c57f7c

Please sign in to comment.