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
<- iris$Sepal.Length
x_vals <- iris$Sepal.Width
y_vals <- iris$Petal.Length
z_vals <- rainbow(3)[iris$Species]
point_cols
# Setup plot
<- plot3js(
data3js x = x_vals,
y = y_vals,
z = z_vals,
xlab = "Se