Skip to content

Commit 8b93f85

Browse files
committed
Fix cmap None in palette.
[skip ci]
1 parent 4eab041 commit 8b93f85

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

panel/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def base_colors(res):
158158
colors = []
159159
# ensure not more colors than states
160160
for cmap in sequential_cmaps()[: res.states[0]]:
161-
color = cmap.resampled(1)(1)
161+
color = cmap(0.5)
162162
color = mpl.colors.rgb2hex(color, keep_alpha=False)
163163
colors.append(color)
164164

src/simdec/visualization.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def sequential_cmaps():
4848
cmap_ = mpl.colormaps[cmap]
4949
except KeyError:
5050
color = mpl.colors.hex2color(cmap)
51-
cmap_ = single_color_to_colormap(color, factor=0.0)
51+
cmap_ = single_color_to_colormap(color)
5252
cmaps.append(cmap_)
5353
return cmaps
5454

@@ -126,7 +126,7 @@ def palette(
126126
n_shades = int(np.prod(states[1:]))
127127
for i in range(n_cmaps):
128128
cmap = cmaps[i].resampled(n_shades + 1)
129-
colors.append(cmap(range(1, n_shades + 1)))
129+
colors.append(cmap(np.linspace(0, 1, n_shades)))
130130

131131
return np.concatenate(colors).tolist()
132132

0 commit comments

Comments
 (0)