Querying dcc.Graph selected legend items

I have an app using Python/Dash/Plotly, including a dcc.Graph component with multiple scatter traces (lines+markers). Some of the points on these lines have annotations (arrow & text bubble).

When I deselect lines in the legend to turn off visibility, I’d like to also turn off the visibility of the lines’ corresponding annotations. So, how can I access this property to use it as an input to a callback?