Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change how upper limit is taken for color_levels #4898

Merged
merged 7 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions holoviews/plotting/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -989,8 +989,7 @@ def color_intervals(colors, levels, clip=None, N=255):
if clip is not None:
clmin, clmax = clip
lidx = int(round(N*((clmin-cmin)/interval)))
uidx = int(round(N*((cmax-clmax)/interval)))
uidx = N-uidx
uidx = len(cmap) - int(round(N*((cmax-clmax)/interval)))
if lidx == uidx:
uidx = lidx+1
cmap = cmap[lidx:uidx]
Expand Down
2 changes: 1 addition & 1 deletion holoviews/tests/plotting/bokeh/test_pathplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def test_path_continuously_varying_color_op(self):
self.assertEqual(source.data['date'], np.array([date]*3))
self.assertEqual(cmapper.low, 994)
self.assertEqual(cmapper.high, 999)
self.assertEqual(cmapper.palette, colors[-1:])
self.assertEqual(np.unique(cmapper.palette), colors[-1:])

def test_path_continuously_varying_alpha_op(self):
xs = [1, 2, 3, 4]
Expand Down
2 changes: 1 addition & 1 deletion holoviews/tests/plotting/test_plotutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ def test_color_intervals_clipped(self):
colors = ['#5ebaff', '#00faf4', '#ffffcc', '#ffe775', '#ffc140', '#ff8f20', '#ff6060']
cmap, lims = color_intervals(colors, levels, clip=(10, 90), N=100)
self.assertEqual(cmap, ['#5ebaff', '#5ebaff', '#5ebaff', '#00faf4', '#00faf4',
'#00faf4', '#00faf4', '#ffffcc'])
'#00faf4', '#00faf4', '#ffffcc', '#ffffcc'])
self.assertEqual(lims, (10, 90))


Expand Down