Annotations are not showing when clicking custom button. I checked it , still didn’t find the problem. Please help me out.
xxx is some 2D array of length tmm
for i in range(0,tmm,2):
fig2.add_trace(go.Scatter3d(x=xxx[i:i+2,2],y=xxx[i:i+2,0],z=xxx[i:i+2,1], mode='lines',
line=dict(
color="black",
width=10),))
ax= xxx[i,2].item()
bx= xxx[i+1,2].item()
ay= xxx[i,0].item()
by= xxx[i+1,0].item()
az= xxx[i,1].item()
bz= xxx[i+1,1].item()
x_annotate=((ax+bx)/2)+0.1
y_annotate=((ay+by)/2)+0.1
z_annotate=((az+bz)/2)+0.1
#(x_annotate, y_annotate, z_annotate)
a1= dict(
showarrow=False,
x=x_annotate,
y=y_annotate,
z=z_annotate,
text=f"Member {mem_index[kk]}",
font=dict(
color="black",
size=8
),)
anno_member.append(a1)
kk= kk+1
button1= [True for i in range ( len(f3))]
Model.update_layout(
updatemenus=[
dict(
type = "buttons",
direction = "left",
buttons=list([
dict(
args=[{'visible': button1},
{"title": "RC Model",
"annotations": []}],
label="RC Model",
method="update",
),
dict(
args=[{'visible': button1},
{"title": "Members ID's",
"annotations": anno}],
label="Member Ids",
method="update"
),
pad={"r": 10, "t": 10},
showactive=True,
x=0.11,
xanchor="left",
y=1.1,
yanchor="middle"
),
]
)
Model.update_layout(height=800, width=800)
Model.show()