How to specify a vertical colorbar label?

A too-long colorbar label string is not visible, as seen below:

import holoviews as hv
import pandas as pd
hv.extension('bokeh')

df = pd.DataFrame({
    'x': ['a', 'a', 'b', 'b'],
    'y': ['c', 'd', 'c', 'd'],
    'z': [1, 2, 3, 4]})
hv_heatmap = hv.HeatMap(df, kdims=['x', 'y'], vdims=['z']).opts(
    invert_yaxis=True, toolbar='above',
    colorbar=True, clabel='Count (numeric scale)')
hv_heatmap

How to specify a vertical colorbar label?
It would be nice if the colorbar label was vertical, see this bokeh stackoverflow.

I have also tried using Panel to add the text manually (in an individual panel next to the heatmap), but this resulted text too far away from the colorbar. My current solution is to use the clabel and make the colorbar wider by using .opts(plot=dict(colorbar_opts={'width': 70})) such that all the text is shown.

2 Likes

I would also love to learn if this is possible. In my case, expanding the colorbar width would be very awkward.

1 Like

@PeterFogh or @emiliom did you managed any workaround or find a useable solution beside expanding the cbars width?

I haven’t.

(Update) I’ve looked through colorbar_opts options available for bokeh, just in case. The best listing I could find is here, but I didn’t see anything obvious – though I’m not a bokeh pro. It looks like this bokeh capability is in the works, but I couldn’t find an indication of how far along it is. It’s part of what sounds like a substantial refactor. There is an old issue about this capability that is still open and has been referenced from time to time.