From 260520e9ec056397e0770c3df8f36b81b80ad7d1 Mon Sep 17 00:00:00 2001 From: Andrew Huang Date: Thu, 22 Aug 2019 23:50:37 -0500 Subject: [PATCH] Add colorbar_opts to mpl --- holoviews/plotting/mpl/element.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/holoviews/plotting/mpl/element.py b/holoviews/plotting/mpl/element.py index 368befb255..fd81cb9705 100644 --- a/holoviews/plotting/mpl/element.py +++ b/holoviews/plotting/mpl/element.py @@ -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.""") @@ -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