The following code generates an interactive plot with a scatter Point plot overlaid on a gridded QuadMesh plot.
import holoviews as hv
import numpy as np
import xarray as xr
import pandas as pd
hv.extension('bokeh')
#create sample gridded data
grid_x = np.linspace(0, 5, 10)
grid_y = np.linspace(0, 5, 10)
grid_data = np.random.rand(len(grid_x), len(grid_y))
grid_data_da = xr.DataArray(grid_data, coords=[grid_x, grid_y], dims=['x', 'y'], name='data')
#create sample point data
point_x = np.arange(5)
point_y = np.arange(5)
point_data = pd.DataFrame(data = {'x':point_x, 'y':point_y})
grid_plot = hv.QuadMesh(grid_data_da)
point_plot = hv.Points(point_data, kdims=['x', 'y']).opts(size = 12, tools = ['tap'])
grid_plot * point_plot
Currently, both the QuadMesh grid cells and the scatter Points respond to a mouse tap (the point/grid cell is highlighted while the res are dimmed). What I want is for only the scatter markers to respond to mouse taps, not the underlying grid cell. I thought that setting the opts()
on only the hv.Points
would do it, but apparently not.
Thanks!
After much digging, I was able to find the answer here
grid_plot = hv.QuadMesh(grid_data_da).opts(nonselection_fill_alpha = 1)