I have searched for an answer to this question, and although there are a couple of similar questions, there isnβt a direct answer.
I have a scattergeo plot, that shows all the time data at the beginning, like this:
I would like it to show on the data at the first step when it first loads, however like this:
Please let me know how to set up the sliders dictionary, or the figure object to make this work. THanks!
Define your Scattergeo plot objects
scattergeo_plots = data
#print(scattergeo_plots)
steps = []
for i in range(len(data)):
y = get_formatted_yr_range(year_ranges[i])
step = dict(
method='update',
args=[{'visible': [False] * len(data)}, {'title': f'Time ({y})'}],
label = y
)
step['args'][0]['visible'][i] = True
steps.append(step)
#print (steps)
# Create the slider configuration
sliders = [{
'active': 0,
'currentvalue': {'prefix': 'Trace: '},
'pad': {'t': 50},
'steps': steps
}]
print(sliders)
# Create figure
fig = go.Figure(
data=scattergeo_plots, # Start with the first plot object
layout=go.Layout(
title="Scattergeo Sliders",
showlegend=False,
geo=dict(
projection_type="natural earth" # Set the desired projection type
),
sliders = sliders
)
)
# Show the figure
fig.show()