3D Scatter Plot

three_scatter(
  x,
  y,
  z,
  size = 1,
  col = 1,
  label = NULL,
  group = 1,
  timestamp = NULL,
  pal = NULL,
  scale = 1,
  axis = TRUE,
  control_panel = TRUE,
  control_presets = NULL,
  camera_pos,
  ...
)

Arguments

x, y, z

numeric vectors with the same length n.

size

size for each point.

col

color vector/matrix, can be either numeric or factor. Its length (vector) or nrow (matrix) must be either n or 1.

label

text label of each observation.

group

categorical group names of each points.

timestamp

numeric vector, length of 0 or ncol(col).

pal

color palette, vector of colors, can be integers.

scale

'auto', NULL, or numeric, rescale the final coordinates. Default 1, no re-scale.

axis

logical, draw axis.

control_panel

logical, show sidebar (control panel).

control_presets

if control_panel is true, which widgets to show.

camera_pos

initial camera position, auto assign if missing.

...

other arguments passing to threejs_brain.

Author

Zhengjia Wang

Examples


#' Continuous color example:

data("iris")
three_scatter(x = iris$Sepal.Length, y = iris$Sepal.Width,
              z = iris$Petal.Length, size = 0.1,
              col = iris$Petal.Width, group = iris$Species,
              pal = c('orange', 'blue3', 'darkgreen'),
              start_zoom = 12, axis = FALSE)


# Discrete example:

x = rnorm(26, c(10, 10, -20))
y = rnorm(26, c(10, -10, 10))
z = rnorm(26, c(10, 40, -10))
three_scatter(x, y, z, size = 1, col = sample(letters[1:3], 20, TRUE),
              pal = c('orange', 'blue3', 'darkgreen'))