Search code examples
pythonanimationplotlyplotly-python

Hide play and stop buttons in plotly express animation


How can I remove the play and stop buttons and just keep the slider?

import plotly.express as px
import pandas as pd

df = pd.DataFrame(dict(x=[0, 1, 0, 1],
                       y=[0, 1, 1, 0],
                       z=[0, 0, 1, 1]))
px.line(df, "x", "y", animation_frame="z")

enter image description here


Solution

  • fig = px.line(df, "x", "y", animation_frame="z")
    fig["layout"].pop("updatemenus")
    fig.show()
    

    enter image description here