l_layer_callback: Tour Layer Configuration

Description Usage Arguments Details Examples

View source: R/l_layer_callback.R

Description

Mainly used in the 2D (or 1D) tour interactive layer configuration

Usage

1
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**

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
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(x)

      loon::l_configure(layer,
                        x = den$x,
                        y = den$y)
  }
}

z267xu/loon.summary documentation built on March 15, 2021, 2:15 p.m.