@dkapitan
There is a scatter attribute hoveron. Unfortunately if you are setting hoveron="fills", the hover over each triangle displays only the trace name.
Hence this option is not a solution. You can define a dummy trace of type scatter, mode=â€śnoneâ€ť, that associates a string (text) to each triangle center of mass:

import plotly.graph_objects as go
import numpy as np
#define data fo your triangles:
x = np.array([0, 1, 2, None, 0, 0.5, 0, None, 0.5, 1.5, 1])
y = np.array([0, 2., 0, None, 1, 2, 2, None, 2.5, 2.5, 4])
#get the indices for None
I = np.where(x==None)[0]
J = np.where(y==None)[0]
X = []
Y = []
#calculate the centers of mass
for i, j in zip(I,J):
X.append(np.mean(x[i-3:i]))
Y.append(np.mean(y[i-3:i]))
X.append(np.mean(x[i+1:]))
Y.append(np.mean(y[i+1:]))
fig = go.Figure(
go.Scatter(
x=x,
y=y,
fill="toself",
mode='none',
hoverinfo='skip'
)
)
fig.add_scatter(x=X, y=Y,
mode='none',
showlegend=False,
text=[f'triangle {k}' for k in range(1, len(I)+2)],
hoverinfo='text')