Inconsistent behavior of colormap for Adjoint layout with hist

I really like the .hist() option that attaches a histogram to a 2D plot, and then can be used for interactively changing the colorbar. However, the problem is that the behavior is inconsistent across different plotting choices. There are at least 3 different behaviors that I have identified so far.

Here is a minimal example:

import xarray as xr
import holoviews as hv
import hvplot.xarray

ds = xr.tutorial.open_dataset("air_temperature")

# Using hvplot: 
# Choice 1
ds.air.hvplot.image(groupby='time').hist()

#Choice 2
ds.air.hvplot.image(rasterize=True, groupby='time').hist()

#Using holoviews
hv_ds = hv.Dataset(ds.air[0:3]) # subset some data to make choice 3 work fast. 

#Choice 3 
hv_ds.to(hv.Image, ['lon', 'lat']).hist()

#Choice 4
hv_ds.to(hv.Image, ['lon', 'lat'], dynamic=True).hist()

The above 4 choices plot something that visually looks similar. However, only choice 3 does what I intuitively expect.

Choice 3: I can select a subrange on the histogram using the Box select feature. This selection then sets the colorscale regardless of whether I pan/zoom the image around or move the time slider.

Choice 4: I can select a subrange, and the corresponding changed colorscale is maintained if I pan/zoom the figure. However, if I adjust the timer slide then the colorscale gets readjusted to the original, but the selected region in the histogram is still highlighted.

Choice 1: Same behavior as choice 4.

Choice 2: I can select a subrange, and the colorbar changes. If I adjust the time slider or pan the image the colorscale gets readjusted to the original, however the selected region in the histogram is still highlighted with region around it slightly grayed out.

I would like to have some option to keep the behavior of choice 3, regardless of the plotting strategy. In particular, it would be nice to keep the behavior of choice 3 when using rasterize=True in Choice 2.

P.S. I am using holoviews version 1.14.1 and hvplot version 0.7.0.

1 Like