Gen.dr.data: Generates 3D data

Description Usage Arguments Details Author(s) Examples

View source: R/gendrdata.r

Description

Generates typical 3D dimension reduction data

Usage

1
Gen.dr.data(type, N=1000)

Arguments

type

one of "swissroll", "scurve" (S-curve), "helix", "ssphere" (severed sphere)

N

number of data points

Details

'Gen.dr.data()' generates some frequently used 3D data. Formulas taken partly from 'tapkee' 'borsch' script and partly from Python 'scikit-learn'.

Author(s)

Alexey Shipunov

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# generate four variants of 3D data

SC <- Gen.dr.data("scurve")
SR <- Gen.dr.data("swissroll")
HX <- Gen.dr.data("helix")
SS <- Gen.dr.data("ssphere")

# plot them (requires packages 'scatterplot3d' and 'rgl')

if (requireNamespace("rgl", quietly = TRUE)) {
 COL <- colorRampPalette(c("green", "orange"))(1000)
 scatterplot3d::scatterplot3d(SC, color=COL, pch=20, cex.symbols=1.4)
} else {
  cat("Please install 'rgl' package to see the plot")
}

if (requireNamespace("rgl", quietly = TRUE)) {
 rgl::plot3d(SR, col=rainbow(1100))
} else {
 cat("Please install 'rgl' package to see the plot")
}

if (requireNamespace("rgl", quietly = TRUE)) {
 rgl::plot3d(HX, col=rainbow(1100))
} else {
 cat("Please install 'rgl' package to see the plot")
}

if (requireNamespace("rgl", quietly = TRUE)) {
 rgl::plot3d(SS, col=rainbow(1100))
} else {
  cat("Please install 'rgl' package to see the plot")
}

tapkee documentation built on Jan. 4, 2021, 5:07 p.m.