I am new to holoviz world, and am trying to create a plot using hvplot/holoviews. I want to make a 2D plot with a dynamic colorbar, which works both automatically and can be controlled by the user if they want to.
I adopted this code to ( based on https://github.com/holoviz/holoviews/issues/2123):
import numpy as np import xarray as xr from holoviews.operation.datashader import regrid hv.extension('bokeh') test_array = xr.DataArray(np.random.rand(460,500) + np.linspace(0,3,500), coords=[np.arange(460), np.arange(500)], dims=['x','y'], name='z') regrid(test_array.hvplot.image(width=400)).hist()
This gives me a nice way to manually set the colorbar by interacting with the histogram. However the problem is that zooming into any part of the plot does not readjust the colorbar.
I can make the colorbar readjust automatically on zoom if I use:
but in this case I lose any manual control.
Is there a way to have both? Be able to manually control the colorbar when I am on a certain zoom level, but the colorbar automatically readjust when the zoom is changed?
Also, is it possible to have dynamic colorbars when using contourf?
I don’t have a reason to use datashader yet since my data set is only a million points, but I am not opposed to it either.