Skip to content

Commit

Permalink
Ensure clim is respected even if only upper or lower bound are set (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr authored Mar 23, 2020
1 parent 1673bce commit fbbf409
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion examples/gallery/demos/bokeh/measles_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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))"
]
Expand Down
9 changes: 5 additions & 4 deletions holoviews/plotting/bokeh/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit fbbf409

Please sign in to comment.