Skip to content

Commit

Permalink
Add cformatter (#3906)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahuang11 authored and philippjfr committed Aug 16, 2019
1 parent 1a383bf commit 4a3e35c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions holoviews/plotting/mpl/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.""")

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 4a3e35c

Please sign in to comment.