Make a Langevin Tour HTML widget, which can be used to explore high-dimensional numeric datasets.

## Usage

langevitour(
X,
group = NULL,
name = NULL,
center = NULL,
scale = NULL,
extraAxes = NULL,
lineFrom = NULL,
lineTo = NULL,
axisColors = NULL,
levelColors = NULL,
colorVariation = 0.3,
pointSize = 1,
subsample = NULL,
state = NULL,
width = NULL,
height = NULL,
elementId = NULL
)

## Arguments

X

The data to plot. A matrix of numeric data, or something that can be cast to a matrix. Rows will be shown as points in the widget. Columns are the variables of your data.

group

A group for each row in X, will be used to color points. A factor, or something that can be cast to a factor.

name

A name for each row in X.

center

Center for each variable. If omitted, the column means will be used.

scale

Scale for each variable. Scale +/- center will be the range of guaranteed visible data. If omitted, a reasonable default will be chosen, equal for all variables. (The default is the largest singular value of the centered X times 2.5.)

extraAxes

A matrix with each column defining a projection of interest. The columns of X %*% extraAxes will be presented as extra "variables".

lineFrom

A vector of row numbers. Draw lines starting at these rows.

lineTo

A vector of row numbers. Draw lines ending at these rows.

axisColors

Character vector. Colors for each variable and then each extra axis.

levelColors

Character vector. Colors for each level of group.

colorVariation

Number between 0 and 1. Individual points are given slightly different brightnesses. How strong should this effect be?

pointSize

subsample

For speed, randomly subsample down to this many rows.

state

A JSON string, or an object that htmlwidgets will convert to the correct JSON. Initial widget state settings. The state of a widget can be obtained by pressing the "?" button. I am not going to guarantee that states will be compatible between versions of langevitour.

width

Width of widget.

height

Height of widget.

elementId

An element ID for the widget, see htmlwidgets::createWidget.

## Value

An htmlwidget object.

## Details

To retain the original units on plot axes within the widget, use center and scale rather than altering X.

langevitour will by default not scale variables individually. If you want variables to be individually scaled, use something like scale=apply(X,2,sd)*4.

In Javascript, the langevitour object can be obtained using document.getElementById(elementId).langevitour. For example you could have a button that sets the state of a widget using document.getElementById(elementId).langevitour.setState(desiredState).

## Examples

library(palmerpenguins)

completePenguins <- na.omit(penguins[,c(1,3,4,5,6)])
scale <- apply(completePenguins[,-1], 2, sd)*4

langevitour(
completePenguins[,-1],
completePenguins\$species,
scale=scale, pointSize=2)