I want to edit the hoverinfo of my markers, while keeping the trendline hoverinfo as the default, or suppressing it altogether. My solution currently returns nothing for the trendline because it doesn't have the necessary criteria.
I would like it to show the default regression information, or 'hide' while using custom_data for the markers.
df = pd.DataFrame({'Expected': {0: 0.119679,
1: 0.11389,
2: 0.108821,
3: 0.10432999999999999,
4: 0.10030800000000001,
5: 0.096677,
6: 0.093375,
7: 0.090352,
8: 0.08757000000000001,
9: 0.084997},
'Counts': {0: 4318,
1: 2323,
2: 1348,
3: 1298,
4: 3060,
5: 6580,
6: 10092,
7: 9847,
8: 8439,
9: 6635},
'Found': {0: 0.080052,
1: 0.043066,
2: 0.024991,
3: 0.024064,
4: 0.056729999999999996,
5: 0.12198699999999998,
6: 0.187097,
7: 0.182555,
8: 0.156452,
9: 0.12300699999999999}})
fig = px.scatter(
df,
x="Found",
y="Expected",
trendline="ols",
trendline_scope = 'overall',
custom_data=['Expected','Found','Counts']
)
fig.update_traces(
hovertemplate="<br>".join([
"expected: %{customdata[0]}",
"found: %{customdata[1]}",
"counts: %{customdata[2]}"
"<extra></extra>"
]))
fig.show()

