I am using Python's plotly.express.line to do an animation. Is it possible to make the transition from frame to frame without interpolation? I am trying with fig.update_layout(transition={'easing': bla_bla_bla})
but cannot make it.
CodePudding user response:
- have created an animated line to demonstrate
fig.layout.updatemenus[0].buttons[0].args[1]["transition"]["duration"] = 0
means play button jumps between frames and there is no transition between frames- easing is already set to linear in this animated figure
import numpy as np
import pandas as pd
import plotly.express as px
df = pd.DataFrame(
{
"x": np.tile(np.linspace(0, 19, 20), 10),
"y": np.random.uniform(1, 5, 200),
"frame": np.repeat(np.linspace(0, 9, 10), 20),
}
)
fig = px.line(df, x="x", y="y", animation_frame="frame")
fig.layout.updatemenus[0].buttons[0].args[1]["transition"]["duration"] = 0
fig