I am trying to plot distributions, and have multiple hover tooltips appear simultaneously at different points on the distribution highlighting different features. As an example, violin plots have the functionality that I want:
import plotly.graph_objects as go
import plotly.io as pio
import numpy as np
fig = go.Figure()
sample = np.random.normal(0, 1, 1000)
fig.add_trace(go.Violin(x=sample))
pio.write_html(fig, 'test.html', auto_open=True)
I would like to do something similar but with e.g. a normal distribution plotted as a line, as below:
import numpy as np
import plotly.graph_objects as go
import plotly.express as px
import plotly.io as pio
fig = go.Figure()
x = np.linspace(-3, 3, 100)
y = np.exp(-np.power(x, 2))
fig = px.line(x=x, y=y)
pio.write_html(fig, 'test.html', auto_open=True)
To this plot I would like to add multiple hover tooltips appearing at different locations such as the mean and various percentiles of the distribution.
I have tried using the customdata argument, but I have only been able to customise the data that appears in a single hover tooltip, rather than create multiple hover tooltips as desired.