Standalone colorbars

Just changing somme small parts you could achieve:

def make_colorbar(cmap, clim, orientation = 'horizontal', position = 'top', colorbar_opts = {}, **kwargs):
    ## create an invisible hv.Heatmap plot just to use its colorbar
    
    hm = hv.HeatMap([(0, 0, clim[0]), (0, 1, clim[1])])
    kwargs.update(dict(colorbar=True, 
                   colorbar_opts=colorbar_opts, 
                   clim=clim,
                   alpha=0,
                   show_frame=False,
                   frame_height=0,
                   colorbar_position=position, 
                   toolbar="disable",
                   margin=(-20,0),
                   cmap=cmap,))

    return hm.opts(**kwargs)
# set the legend_pane object as the Layout of node_bar + edge_cbar
self.legend_pane.object = (node_cbar+edge_cbar).opts(toolbar=None)
window = pn.GridSpec(ncols=3, sizing_mode="stretch_both", min_height=0)
3 Likes