diff --git a/holoviews/plotting/mpl/element.py b/holoviews/plotting/mpl/element.py index 2fad5441e0..02614f89d7 100644 --- a/holoviews/plotting/mpl/element.py +++ b/holoviews/plotting/mpl/element.py @@ -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], diff --git a/tests/plotting/matplotlib/testelementplot.py b/tests/plotting/matplotlib/testelementplot.py index fc188546bd..5f58e2df4a 100644 --- a/tests/plotting/matplotlib/testelementplot.py +++ b/tests/plotting/matplotlib/testelementplot.py @@ -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)