Hi.
I am trying to create an animated plot where, in addition to the slider and the play/pause buttons that exist by default, I need buttons for moving one frame forward and backward. Here is some code for a small example that shows the animation for which I am trying to achieve this:
import pandas as pd
import numpy as np
from plotly import express as px
data = np.random.uniform(size=(100, 30))
rows = []
for i in range(100):
for j in range(30):
rows.append([i, j+1, data[i, j]])
df = pd.DataFrame(rows, columns=["curve_id", "X", "Y"])
fig = px.line(df, x="X", y="Y", animation_frame="curve_id", animation_group="curve_id")
# set the framerate of the animation
fig.layout.updatemenus[0].buttons[0].args[1]["frame"]["duration"] = 200
# make the transition between frames instant
fig.layout.updatemenus[0].buttons[0].args[1]["transition"]["duration"] = 0
fig.layout.sliders[0]["tickcolor"] = "white"
fig.layout.sliders[0]["font"]["color"] = "white"
fig.layout.sliders[0]["currentvalue"]["font"]["color"] = "black"
fig.layout.sliders[0]["currentvalue"]["prefix"] = "curve_id: "
fig.show()
In this example, the animation contains 100 curves (frames). In practice, the animation is supposed to contain multiple thousand frames. Because of this, it will not be practical to search the animation for specific frames using the slider. I am not sure if this plays a role for the solution but I want to use this animation inside of a Dash application.
Any help with this is greatly appreciated!