Utility function to automatically add required parameters to a plotly object
for reliable linking, regardless of plot structure (single/multiple traces).
Usage
prepare_plotly_linking(plotly_obj, id_column, source)
Arguments
- plotly_obj
A plotly object created with plot_ly()
- id_column
Character string: name of the ID column in the data
- source
Character string: plotly source identifier
Value
Modified plotly object with linking parameters added
Examples
if (FALSE) { # \dontrun{
# Instead of manually adding customdata/key:
p <- plot_ly(data = iris, x = ~Sepal.Length, y = ~Sepal.Width, color = ~Species)
p <- prepare_plotly_linking(p, "Species", "iris_plot")
} # }