Skip to content

Commit

Permalink
Fixed undefined variable bug (#2584)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr authored and jlstevens committed Apr 20, 2018
1 parent e0fa4ad commit cc41352
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions holoviews/plotting/mpl/element.py
Expand Up @@ -616,6 +616,9 @@ def _norm_kwargs(self, element, ranges, opts, vdim, prefix=''):
else:
clim = (0, len(np.unique(values))-1)
categorical = True
else:
categorical = values.dtype.kind not in 'uif'

if self.logz:
if self.symmetric:
norm = mpl_colors.SymLogNorm(vmin=clim[0], vmax=clim[1],
Expand Down
6 changes: 6 additions & 0 deletions tests/plotting/matplotlib/testelementplot.py
Expand Up @@ -32,6 +32,12 @@ def test_colormapper_symmetric(self):
artist = plot.handles['artist']
self.assertEqual(artist.get_clim(), (-3, 3))

def test_colormapper_clims(self):
img = Image(np.array([[0, 1], [2, 3]])).options(clims=(0, 4))
plot = mpl_renderer.get_plot(img)
artist = plot.handles['artist']
self.assertEqual(artist.get_clim(), (0, 4))

def test_colormapper_color_levels(self):
img = Image(np.array([[0, 1], [2, 3]])).options(color_levels=5)
plot = mpl_renderer.get_plot(img)
Expand Down

0 comments on commit cc41352

Please sign in to comment.