Hey guys when I am using this code, the annotated text is not able to be completely rendered before the image is generated by plotly.
fig.write_image(f'ethnicity_distribution.svg',width=1200, height=800)
These are my annotations that are on the map. Doing a custom screenshot using a headless browser works but itβs random and I have to add my own await time in it. Is there an inbuilt way?
#Annotations for pie %
for index, row in full_df.iterrows():
text_pos = row.orientation
# Create a scattermapbox trace for each point
pie_slice_text = go.Scattermapbox(
#lat=[row.pie_slice.centroid.y],
#lon=[row.pie_slice.centroid.x],
lat=[row.annotation_point.y],
lon=[row.annotation_point.x],
mode='markers+text',
text=[f"{row['value']:.0%}"],
textposition=text_pos,
textfont=dict(color='black'),
#textfont=dict(color=category_colors.get(row.region, 'black')),
marker=dict(size=0),
showlegend=False,
)
# Add the trace to the figure
fig.add_trace(pie_slice_text)