Streamit autoplay

plotly-express.histogram graph autorun not working

Code snippet:

import streamlit as st
import pandas as pd
import webbrowser
import as px
import io
Time Value Name Type
0 6.9 A start
40 6.9 A start
 120 6.9 A start
0 0.01 B start
40 0.01 B start
 120 0.01 B start
0 1.0 C start
40 1.0 C start
 120 1.0 C start
0 0.08 D start
40 0.08 D start
 120 0.08 D start
0 0.000131 E End
40 0.00032 E End
 120 0.99209 E End
0 0.002754 F End
40 0.00392 F End
 120 0.01857 F End
0 0.003 G End
40 0.00516 G End
 120 0.00746 G End
0 0.00426 H End
40 0.0043 H End
 120 0.0095 H End
0 0 I End
40 0.0017 I End
 120 0.0183 I End
df = pd.read_csv(io.StringIO(data), delim_whitespace=True)
pmax = df['Value'].max()
pmin = df['Value'].min()
fig_bar =,x='Name',y='Value',color='Name',animation_frame='Time',facet_row='Type')

fig_bar.for_each_yaxis(lambda yaxis: yaxis.update(showticklabels=True))
fig_bar.for_each_xaxis(lambda xaxis: xaxis.update(showticklabels=True))
fig_bar.update_traces(hovertemplate='Time: %{y:.2f}'+'<br>Name: %{x}')
fig_bar.layout.updatemenus[0].buttons[0].args[1]["frame"]["duration"] = 1000

url = 'test.html', new=2) 

Expected behavior:

One can see histogram plot in streamlit need to press play button to run where as the same plot in webbrowser is running automatically. Is it possible for streamlit-plotly graph run automatically like auto_play=True.
B. Also the yaxis in top graph saying sum of value instead of conc
Actual behavior:

Explain the undesired behavior or error you see when you run the code above.
If youโ€™re seeing an error message, share the full contents of the error message here.

Debug info

  • Streamlit version: (get it with $ streamlit version)
  • Python version: (get it with $ python --version)
  • Using Conda? PipEnv? PyEnv? Pex?
  • OS version:
  • Browser version:

Requirements file

Using Conda? PipEnv? PyEnv? Pex? Share the contents of your requirements file here.
Not sure what a requirements file is? Check out this doc and add a requirements file to your app.


  • Link to your GitHub repo:
  • Link to your deployed app:

Additional information

If needed, add any other context about the problem here.

Hey @hrani,

Is this same histogram autoplaying when itโ€™s not in a Streamlit app?

Yes, from the last 3 line if one can run, browser opens and graph runs

st.plotly_chart(fig_bar,auto_play=True) wonโ€™t autoplay it since thatโ€™s not a supported parameter. One thing I would try is using offline mode (sharing=streamlit) and then passing Plotlyโ€™s autoplay parameter to **kwargs.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.