PlotlyAnimate
Wolfram Kernel
Execution environment
PlotlyAnimate[p_PlotlyInstance, data_Association, transition_Association, opts___]
animates efficiently any Plotly graph with a new data
with a specified transition
.
tip
See the official reference
Options
"Window"
By default, the "Window"
option is set to "Inherited"
. This setting dynamically uses the currently active window associated with the PlotlyInstance
.
When set to "Inherited"
, even if a new window is opened using the same instance, it will be detected automatically. This is possible because all PlotlyInstance
objects perform a handshake after mounting on the page.
To override this behavior, you can provide a specific WindowObj
as an option.
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];