l_layer_callback {loon.tourr} | R Documentation |
Tour Layer Configuration
Description
Mainly used in the 2D (or 1D) tour interactive layer configuration
Usage
l_layer_callback(target, layer, ...)
Arguments
target |
either a 'l_tour' object or a loon widget |
layer |
the layer need to be modified |
... |
some useful info for the layer configuration (i.e. tours, projections, etc) |
Details
It is a S3
method. The object class is determined by the layer **label**
Value
this callback function does not return any object. As the slider bar is scrolled, for the specified layer, the callback function will be fired and the layer will be configured.
Examples
if(interactive() && requireNamespace("tourr")) {
# 1D tour
p <- l_tour(iris[, -5], tour = tourr::grand_tour(1L))
# add layer density
l <- l_layer(l_getPlots(p),
stats::density(p['x']),
label = "density")
# as we scroll the bar, the density curve does not change
# unless the following function is executed
l_layer_callback.density <- function(target, layer, ...) {
layer <- loon::l_create_handle(c(l_getPlots(target), layer))
den <- stats::density(target['x'])
loon::l_configure(layer,
x = den$x,
y = den$y)
invisible()
}
}
[Package loon.tourr version 0.1.4 Index]