An HTML widget to toggle display of elements of a scene
toggleWidget.RdThis function produces a button in an HTML scene that will toggle the display of items in the scene.
Arguments
- sceneId
The HTML id of the RGL scene being controlled, or an object as in
playwidget.The RGL id numbers of the objects to toggle. Those in
idsare initially shown; those inhiddenare initially hidden.Alternate way to specify
ids. Ignored ifidsis given.- subscenes
The subscenes in which to toggle the objects.
- label
The label to put on the button. The default is set from the expression passed to
idsor the value oftags.- ...
Additional arguments to pass to
playwidget.
Details
Like playwidget, this function is designed
to work within the htmlwidgets framework.
If the value is printed, the button will be inserted
into the output.
It is also designed to work with magrittr-style
pipes: the result of rglwidget or
other widgets can be piped into it to add it
to a display. It can also appear first in the
pipeline, if sceneId is set to NA.
See also
toggleButton for the older style
of HTML control. The User Interaction in WebGL
vignette
gives more details.
Examples
theplot <- plot3d(rnorm(100), rnorm(100), rnorm(100), col = "red")
widget <- rglwidget(height = 300, width = 300) %>%
toggleWidget(theplot["data"],
hidden = theplot[c("xlab", "ylab", "zlab")],
label = "Points")
if (interactive() || in_pkgdown_example())
widget