show_slice {detourr}R Documentation

2D and 3D Slice Display for Tours

Description

An implementation of the Slice Tour described in Laa et al., 2020. Points close to the projection plane are highlighted, and those far away are faded out.

Usage

show_slice(
  x,
  ...,
  palette = viridis,
  center = TRUE,
  axes = TRUE,
  edges = NULL,
  paused = TRUE,
  scale_factor = NULL,
  slice_relative_volume = 0.1,
  anchor = NULL
)

Arguments

x

a detour object

...

used to support aesthetic parameters for the plot, including

  • size: point size, defaults to 1

  • alpha: point opacity, defaults to 1

  • background_colour: defaults to "white"

palette

Colour palette to use with the colour aesthetic. Can be:

  • A character vector of R colours. This should match the number of levels of the colour aesthetic, or the number of bins to use for continuous colours.

  • A function which takes the number of colours to use as input and returns a character vector of colour names and / or hex values as output.

center

If TRUE, center the projected data to (0, 0, 0).

axes

Can be one of:

  • TRUE draw axes and use column names for axis labels

  • FALSE do not draw axes or labels

  • NULL draw axes with no labels

  • An unnamed vector of labels with the same length as cols

  • A named vector in the form c("h" = "head"), where head is renamed to h

edges

A two column numeric matrix giving indices of ends of lines.

paused

whether the widget should be initialised in the 'paused' state

scale_factor

used as a multiplier for the point coordinates so they are displayed on a sensible range. Defaults to the reciprocal of maximum distance from a point to the origin.

slice_relative_volume

number default 0.1. Controls the relative volume of the slice and thus the number of points which are highlighted. This is an approximate value and is only accurate for values << 1

anchor

anchor vector of length p to offset the projection plane when calculating the distance from each point to the projection plane.

Details

This display method produces an interactive scatterplot animation which supports both 2D and 3D tours. Linked selection and filtering is also supported using crosstalk. The set of interactive controls available are:

Value

An object of class htmlwidget

References

Laa, U., Cook, D., & Valencia, G. (2020). A slice tour for finding hollowness in high-dimensional data. Journal of Computational and Graphical Statistics, 29(3), 681-687.

See Also

show_scatter

Examples

x <- geozoo::torus(p = 4, n = 10000)$points |>
  tibble::as_tibble(.name_repair = "unique")

detour(x, tour_aes(projection = everything())) |>
  tour_path(grand_tour(2)) |>
  show_slice(slice_relative_volume = 0.1)

[Package detourr version 0.1.0 Index]