Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cformatter #3906

Merged
merged 1 commit into from
Aug 16, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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