I’m having trouble understanding the logic (feature? bug?) behind tap-selection behavior of a simple points plot with labels.
Take the (slightly modified) example from the hvplot user reference:
import hvplot.pandas # noqa
import pandas as pd
df = pd.DataFrame(
{'City': ['Buenos Aires', 'Brasilia', 'Santiago', 'Bogota', 'Caracas'],
'Country': ['Argentina', 'Brazil', 'Chile', 'Colombia', 'Venezuela'],
'Latitude': [-34.58, -15.78, -33.45, 4.60, 10.48],
'Longitude': [-58.66, -47.91, -70.66, -74.08, -66.86]})
points = df.hvplot.points(x='Longitude', y='Latitude', padding=0.2, hover_cols='all', width=300)
labels = df.hvplot.labels(x='Longitude', y='Latitude', text='City', text_baseline='bottom', hover=False)
overlay = (points * labels)
points.opts(tools=['tap'])
overlay.opts(
opts.Labels(text_font_size='8pt', xoffset=0.08),
opts.Points(color='black', size=5, active_tools=['tap'],)
)
By tapping, I can apparently select the label or the marker, but it seems that they do not result in the same selection. Or am I missing something?
More importantly, can I disable selection for the labels?
For hv.Points
, I understand I can do something like points.opts(nonselection_alpha = 1)
, and have the nonselected points appear unchanged upon selection, but running labels.opts(nonselection_alpha = 1)
throws me a ValueError: Unexpected option 'nonselection_alpha' for Labels type across all extensions. No similar options found.