dsldScatterPlot3D: ScatterPlot3D in dsld

View source: R/dsldScatterPlot3D.R

dsldScatterPlot3DR Documentation

ScatterPlot3D in dsld

Description

Plotly 3D visualization of a dataset on 3 axes, with points color-coded on a 4th variable.

Usage

dsldScatterPlot3D(data, yNames, sName, sGroups = NULL, sortedBy =
  "Name", numGroups = 8, maxPoints = NULL, xlim = NULL,
  ylim = NULL, zlim = NULL, main = NULL, colors =
  "Paired", opacity = 1, pointSize = 8)

Arguments

data

Data frame with at least 4 columns.

yNames

Vector of the indices or names of the columns of the data frame to be graphed on the 3 axes.

sName

Index or name of the column that contains the groups for which the data will be grouped by. This will affect the colors of the points of the graph. This column must be an R factor.

sGroups

Vector of the names of the groups for which the data will be grouped by. Every value in the vector must exist in the sName column of the data frame. If not supplied or is NULL, the function will create this automatically according to the sortedby and numgrps parameters. By default, the function uses the 8 alphabetically first distinct groups in the sName column.

sortedBy

Controls how sGroups is created automatically. If sGroups is supplied, this does nothing. One of three values: "Name", "Frequency", "Frequency-Descending".

"Name" gets the first values alphabetically. "Frequency" gets the most frequently occuring values. "Frequency-Descending" gets the least frequently occuring values.

numGroups

Number of groups to be automatically generated by the function. If grpnames is supplied, this does nothing.

maxPoints

Limit to how many points may be displayed on the graph. There is no limit by default.

xlim, ylim, zlim

The x, y and z limits, each a vector with c(min, max).

main

The title of the graph. By default, the sName "vs. " yNames.

colors

Either a colorbrewer2.org palette name (e.g. "YlOrRd" or "Blues"), or a vector of colors to interpolate in hexadecimal "#RRGGBB" format, or a color interpolation function like colorRamp().

opacity

A value between 0 and 1.

pointSize

A value above 1.

Details

An interactive Plotly visualization will be created, with the three variables specified in yNames. Points will be color-coded according to sName. The plot can be rotated etc. using the mouse.

Value

No value, plot.

Author(s)

J. Tran and B. Zarate

References

https://plotly.com/r/3d-scatter-plots/

Examples

data(lsa)
dsldScatterPlot3D(lsa,sName = "race1", 
   yNames=c("ugpa", "lsat","age"), xlim=c(2,4))

dsld documentation built on Sept. 14, 2024, 1:08 a.m.