From fbbf40928feba68b76faa11f80505d80f9049f31 Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Mon, 23 Mar 2020 16:15:44 +0100 Subject: [PATCH] Ensure clim is respected even if only upper or lower bound are set (#4314) --- examples/gallery/demos/bokeh/measles_example.ipynb | 3 ++- holoviews/plotting/bokeh/element.py | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/examples/gallery/demos/bokeh/measles_example.ipynb b/examples/gallery/demos/bokeh/measles_example.ipynb index 3b2e6dce95..98f85cb863 100644 --- a/examples/gallery/demos/bokeh/measles_example.ipynb +++ b/examples/gallery/demos/bokeh/measles_example.ipynb @@ -68,7 +68,8 @@ "overlay = (heatmap + agg * vline * marker).cols(1)\n", "overlay.opts(\n", " opts.HeatMap(width=900, height=500, tools=['hover'], logz=True, \n", - " invert_yaxis=True, labelled=[], toolbar='above', xaxis=None),\n", + " invert_yaxis=True, labelled=[], toolbar='above',\n", + " xaxis=None, colorbar=True, clim=(1, np.nan)),\n", " opts.VLine(line_color='black'),\n", " opts.Overlay(width=900, height=200, show_title=False, xrotation=90))" ] diff --git a/holoviews/plotting/bokeh/element.py b/holoviews/plotting/bokeh/element.py index d346ea2033..de1e2afa19 100644 --- a/holoviews/plotting/bokeh/element.py +++ b/holoviews/plotting/bokeh/element.py @@ -1483,7 +1483,6 @@ def _init_glyphs(self, plot, element, ranges, source, data=None, mapping=None, s style = self.style[self.cyclic_index] data, mapping, style = self.get_data(element, ranges, style) - keys = glyph_order(dict(data, **mapping), self._draw_order) source_cache = {} @@ -1730,9 +1729,7 @@ def _get_colormapper(self, eldim, element, ranges, style, factors=None, colors=N ncolors = None if factors is None else len(factors) if eldim: # check if there's an actual value (not np.nan) - if util.isfinite(self.clim).all(): - low, high = self.clim - elif dim_name in ranges: + if dim_name in ranges: low, high = ranges[dim_name]['combined'] elif isinstance(eldim, dim): low, high = np.nan, np.nan @@ -1741,6 +1738,10 @@ def _get_colormapper(self, eldim, element, ranges, style, factors=None, colors=N if self.symmetric: sym_max = max(abs(low), high) low, high = -sym_max, sym_max + if util.isfinite(self.clim[0]): + low = self.clim[0] + if util.isfinite(self.clim[1]): + high = self.clim[1] else: low, high = None, None