Grouping plot elements

Sometimes you may want to include more complex patterns of interactivity into a plot, for example where interaction with one plot elements triggers changes or appearance / disappearance in a wider group of other plot elements.

In this case you can utilise the ability to group elements in a plot, so that interaction with any one of the group elements that has been indicated as interactive with the argument interactive = TRUE will trigger changes as specified by highlight in all other plot elements in the same group.

The example below builds up a plot with more complex interactivity based on these principles.

# Set data
x_vals <- iris$Sepal.Length
y_vals <- iris$Sepal.Width
z_vals <- iris$Petal.Length
point_cols <- rainbow(3)[iris$Species]

# Setup plot
data3js <- plot3js(
  x = x_vals,
  y = y_vals,
  z = z_vals,
  xlab = "Se