R: Add points to a 3D scatterplot

points3d {threejs} | R Documentation

## Add points to a 3D scatterplot

### Description

Add points to a 3D scatterplot

### Usage

    points3d(s, x, y, z, color = "orange", pch = "@", size = 1, labels = "")

### Arguments

`s` | A non-animated scatterplot object returned by `scatterplot3js`.
`x` | Either a vector of x-coordinate values or a three-column data matrix with columns corresponding to the x,y,z coordinate axes. Column labels, if present, are used as axis labels.
`y` | (Optional) vector of y-coordinate values, not required if `x` is a matrix.
`z` | (Optional) vector of z-coordinate values, not required if `x` is a matrix.
`color` | Either a single hex or named color name (all points same color), or a vector of hex or named color names as long as the number of data points to plot.
`pch` | Optional point glyphs or text strings, see `scatterplot3js`.
`size` | The plot point radius, either as a single number or a vector of sizes of length `nrow(x)`.
`labels` | Character vector of length `x` of point labels displayed when the mouse moves over the points.

### Value

A new scatterplot htmlwidget object.

### Note

This function replaces the old `points3d` approach used by `scatterplot3d`.

### Examples

    ## Not run:
     # Adding point labels to a scatterplot:
     x <- rnorm(5)
     y <- rnorm(5)
     z <- rnorm(5)
     scatterplot3js(x, y, z, pch="o") %>%
       points3d(x + 0.1, y + 0.1, z, color="red", pch=paste("point", 1:5))

    # Adding point labels to a graph, obtaining the graph vertex coordinates
    # with the `vertices()` function:
    data(LeMis)
    graphjs(LeMis) %>% points3d(vertices(.), color="red", pch=V(LeMis)$label)

    ## End(Not run)

[Package threejs version 0.3.1 Index]