Hi
I would like to achieve the effect of blinking or to have a new color of the last coordinate that is being plotted for each step on the slider.
import plotly
import pandas as pd
import plotly.graph_objects as go
df = pd.DataFrame(
{'City': ['Buenos Aires', 'Brasilia', 'Santiago', 'Bogota', 'Caracas'],
'Country': ['Argentina', 'Brazil', 'Chile', 'Colombia', 'Venezuela'],
'lat': [-34.58, -15.78, -33.45, 4.60, 10.48],
'lon': [-58.66, -47.91, -70.66, -74.08, -66.86]})
fig=go.Figure(go.Scattermapbox(
lat=[df.loc[0, 'lat']],
lon=[df.loc[0, 'lon']],
mode='markers',
marker=dict(size=10, color='red')
))
fig.update_layout(mapbox=dict(#accesstoken=mapbox_access_token,
bearing=0,
pitch=0,
style='carto-positron'))
frames = [go.Frame(data= [go.Scattermapbox(
lat=df.loc[:k+1, 'lat'],
lon=df.loc[:k+1, 'lon'])],
traces= [0],
name=f'frame{k}'
)for k in range(len(df))]
fig.update(frames=frames);
sliders = [dict(steps= [dict(method= 'animate',
args= [[ f'frame{k}'],
dict(mode= 'immediate',
frame= dict(duration=100, redraw= True ),
transition=dict( duration= 0))
],
label='{:d}'.format(k)
) for k in range(len(df))],
transition= dict(duration= 0 ),
x=0,#slider starting position
y=0,
currentvalue=dict(font=dict(size=12),
prefix='Point: ',
visible=True,
xanchor= 'center'),
len=1.0)
]
fig.update_layout(updatemenus=[dict(type='buttons', showactive=False,
y=0,
x=1.05,
xanchor='right',
yanchor='top',
pad=dict(t=0, r=10),
buttons=[dict(label='Play',
method='animate',
args=[None,
dict(frame=dict(duration=100,
redraw=True),
transition=dict(duration=0),
fromcurrent=True,
mode='immediate'
)
]
)
]
)
],
sliders=sliders);
fig.show()
Thank you for any help.