Skip to main content

PlotlyAnimate

Wolfram Kernel
Execution environment
Notebook`Kernel`PlotlyExtension`
Context
PlotlyAnimate[p_PlotlyInstance, data_Association, transition_Association]

animates efficiently any Plotly graph with a new data with a specified transition.

Example

An example

p = Plotly[<|
"y" -> Table[Sin[2Pi x / 100.0], {x,100}],
"mode"-> "markers",
"type"-> "scatter"
|>]
freq = 0.5;
task = SetInterval[
PlotlyAnimate[p,
<|
"data" -> {
<|"y" -> Table[Sin[freq Pi x / 100.0], {x,100}]|>
},
"trace" -> {0},
"layout" -> <||>
|>,
<|
"transition" -> <|
"duration"->30,
"easing"->"linear"
|>,

"frame" -> <|
"duration"->30
|>
|>
];

freq += 0.3;
, 30];

SetTimeout[TaskRemove[task], 2000];