In python3 I wrote a code to generate scatter plot graph using plotly and it has a slider to go through the different dates without changing graphs which is very useful.
However, when I open my graph the slider automatically starts slidding and going through the different dates.It there a possible way to block this option? In other words, is there a way to not allow my graph to automatically start the slider when I open it ?
Here is my code, I tried to put a very high duration but it did not change anything:
data = pd.read_csv('/homeResult-'+str(filename)+'.csv')
data['price'] = data['price'].astype(int)
fig = px.scatter(data, x = "model", y = "price", color="competitor", hover_data=['Discount'], animation_frame="date")
fig.update_layout(
title=str(filename).replace('.csv', ''),
yaxis_title="Price (€)",
font=dict(
size=12,
color="#7f7f7f"
)
)
#fig.update_layout(margin=dict(l=20, r=20, t=20, b=20),paper_bgcolor="LightSteelBlue")
fig['layout']['updatemenus'][0]['pad']['t'] = 180
fig['layout']['sliders'][0]['pad']['t'] = 200
fig.update_layout(transition = {'duration': 0})
fig.write_html("/homevisualisation/Viz-"+str(filename)+".html")
This is the slider I am talking about :
