Skip to content

Commit

Permalink
Add colorbar_opts to mpl (#3925)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahuang11 authored and philippjfr committed Sep 20, 2019
1 parent 19f4c30 commit c525cbd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion holoviews/plotting/mpl/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,9 @@ class ColorbarPlot(ElementPlot):
colorbar = param.Boolean(default=False, doc="""
Whether to draw a colorbar.""")

colorbar_opts = param.Dict(default={}, doc="""
Allows setting specific styling options for the colorbar.""")

color_levels = param.ClassSelector(default=None, class_=(int, list), doc="""
Number of discrete colors to use when colormapping or a set of color
intervals defining the range of values to map each color to.""")
Expand Down Expand Up @@ -789,7 +792,8 @@ def _draw_colorbar(self, element=None, dimension=None, redraw=True):
scaled_w = w*width
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)
cbar = fig.colorbar(artist, cax=cax, ax=axis,
extend=self.cbar_extend, **self.colorbar_opts)
self._set_axis_formatter(cbar.ax.yaxis, dimension, self.cformatter)
self._adjust_cbar(cbar, label, dimension)
self.handles['cax'] = cax
Expand Down

0 comments on commit c525cbd

Please sign in to comment.