I have a function that takes an array as a parameter and displays just the first value of the array. But in my console, it displays twice. Here is the function
def add_annotation(self, data_array, fig):
if fig is not None:
x_pos = data_array[0]['min'][0]
y_pos = data_array[0]['min'][2]
ps = float(data_array[0]['ps'])
mds = float(data_array[0]['mds'])
hill = data_array[0]['id']
annotation_text = f"{hill} <br> PS: {ps:.2f} <br> MDS: {mds:.2f}"
print(x_pos, y_pos)
fig.add_annotation(
x=x_pos,
y=y_pos,
xref="x",
yref="y",
text=annotation_text,
showarrow=True,
font=dict(family="Courier New, monospace", size=16, color="#FFFFFF"),
align="center",
arrowhead=2,
arrowsize=1,
arrowwidth=2,
arrowcolor="red",
ax=50,
ay=-90,
bgcolor="black",
)
And here is my output
Please any idea of what is happening?