From 4a3e35c0f496e43315f9c3dcb92616d8988654b7 Mon Sep 17 00:00:00 2001 From: Andrew <15331990+ahuang11@users.noreply.github.com> Date: Fri, 16 Aug 2019 04:18:46 -0500 Subject: [PATCH] Add cformatter (#3906) --- holoviews/plotting/mpl/element.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/holoviews/plotting/mpl/element.py b/holoviews/plotting/mpl/element.py index f42eec7e74..f24ce9c09e 100644 --- a/holoviews/plotting/mpl/element.py +++ b/holoviews/plotting/mpl/element.py @@ -663,6 +663,10 @@ class ColorbarPlot(ElementPlot): User-specified colorbar axis range limits for the plot, as a tuple (low,high). If specified, takes precedence over data and dimension ranges.""") + cformatter = param.ClassSelector( + default=None, class_=(util.basestring, ticker.Formatter, FunctionType), doc=""" + Formatter for ticks along the colorbar axis.""") + colorbar = param.Boolean(default=False, doc=""" Whether to draw a colorbar.""") @@ -770,6 +774,7 @@ def _draw_colorbar(self, element=None, dimension=None, redraw=True): cax = fig.add_axes([l+w+padding+(scaled_w+padding+w*0.15)*offset, b, scaled_w, h]) cbar = fig.colorbar(artist, cax=cax, ax=axis, extend=self._cbar_extend) + self._set_axis_formatter(cbar.ax.yaxis, dimension, self.cformatter) self._adjust_cbar(cbar, label, dimension) self.handles['cax'] = cax self.handles['cbar'] = cbar