This is more of a feature question, but does anyone know if it’s possible to use a callback to either:
a) add the text
attribute, for that datapoint
b) add an annotation
, for that datapoint
c) enable clickmode: select
, for that datapoint
any of these options would work for my use case. can’t find a question that covers all of the above in an any fashion, so posing this here. thanks in advance!
Found it. define x and y from your filter, then pass those into a loop that adds annotations.
def impossible_excl(countries):
fig = scientific_layout(fig_B_bubblechart(beer, dem, pop))
if not countries:
pass
else:
for country in countries:
ann_x = beer[2017][beer.index == country].values
ann_y = dem[2017][dem.index == country].values
label = country
print(ann_x, ann_y)
ann = {
"x": ann_x[0],
"y": ann_y[0],
"text": label,
"showarrow": False,
}
fig.add_annotation(ann)
return fig