Skip to main content

PlotlyRestyle

Wolfram Kernel
Execution environment
PlotlyRestyle[p_PlotlyInstance, update_Association, opts___]
PlotlyRestyle[p_PlotlyInstance, update_Association, trace_Integer, opts___]
PlotlyRestyle[p_PlotlyInstance, update_Association, {traces__Integer}, opts___]

an efficient means of changing attributes in the data array in an existing plot.

Mush faster than PlotlyReact

For example

p = Plotly[<|"type"->"line", "y"->{1,2,3,4,5,6}|>]

Change the color of markers

PlotlyRestyle[p, <|"opacity"->0.4, "marker.color"->"red"|>];

Here is an interactive example

p = Plotly[<|"type"->"line", "y"->{1,2,3,4,5,6}|>]

EventHandler[InputRange[0,1,0.1,1.0], (PlotlyRestyle[p, <|"opacity"->#, "marker.color"->"red"|>])&]

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.