Learn R Programming

vrmlgen (version 1.3)

lcloud: Create scatter plots for 3D data matrices in LiveGraphics3D-format

Description

lcloud translates 3D point data, i.e. numerical matrices with 3 columns and n rows, into visual representations in the LiveGraphics3D-format. Please make sure that the file "live.jar", which can be obtained from http://www.fktech.eu/fr/enligne/doc-fr/LG3Dfr/LG3DInstallation.htm, is saved in the same folder as the generated output files.

Usage

lcloud(data, labels = rownames(data), metalabels = NULL, 
urllabels = NULL, filename = "out.m", pointstyle = c("s", "b",
"t"), cols = rainbow(length(unique(labels))), scalefac = 4,
autoscale = "independent", lab.axis = c("X-axis", "Y-axis",
"Z-axis"), col.axis = "black", showaxis = TRUE,
col.lab = "black", col.metalab = "black", col.bg = "white",
cex.lab = 1, ambientlight = 0.5, htmlout = NULL, hwidth = 1200,
hheight = 800, mode2d = FALSE, showlegend = TRUE)

Arguments

data
a numerical matrix with 3 columns and n rows
labels
a vector of size n containing the group labels (strings or numbers) of the data points
metalabels
a vector of strings or numbers containing optional metalabels for the rows which can be accessed in the plot by clicking on a data point with the mouse)
urllabels
a vector of strings containing hyperlinks which can be accessed from the plot by clicking on a data point with the mouse
filename
filename of the generated LiveGraphics3D output file
pointstyle
a vector of point style types, possible types are "s" for spheres, "b" for boxes and "t" for tetrahedron. Use a vector of size 1 to draw all points in the same type, otherwise the number of used point styles must be at least as high as the
cols
a vector of colors to visualize different classes among the data points. The number of colors should be at least as large as the number of different labels (i.e. length(col) >= length(unique(labels))
scalefac
a scaling factor for the size of the 3D box in which the data will be visualized
autoscale
the scaling type. "independent" means all axes are auto-scaled independently, "equidist" means all axes are scaled by the same factor, "none" means no scaling is applied
lab.axis
a vector of size 3 containing the axis labels
col.axis
color of the axis
showaxis
if FALSE, the coordinate axes are hidden in the output
col.lab
a vector of colors specifying the axis labels
col.metalab
a vector of colors specifying the meta labels
col.bg
background color
cex.lab
scaling factor for axis label font size
ambientlight
ambient light gray level (between 0 and 1)
htmlout
a filename for generating an HTML-file to embed the VRML-output
hwidth
width of the embedded VRML-display in the HTML-output
hheight
height of the embedded VRML-display in the HTML-output
mode2d
generate a zoomable 2D plot (the z-coordinates of the input matrix are set to zero)
showlegend
a logical value indicating whether a legend should be drawn on the plot

Value

  • The function is used for its side-effect (output of a LiveGraphics3D-file and optionally an HTML-page in the specified directory) and has no return value. The htmlout-parameter can be used to embed the resulting LiveGraphics3D object in a HTML-file.

References

Martin Kraus. LiveGraphics3D - a non-commercial Java 1.1 applet. URL: http://wwwvis.informatik.uni-stuttgart.de/~kraus/index.html

See Also

vcloud, vbar, lbar

Examples

Run this code
# example 1: visualize random 3D input data
mat <- matrix(runif(99, 0, 3), ncol=3)

# create random class assignment vector with three classes
y <- round(runif(33, 0, 2))
y <- ifelse(y == 0, "class 1", ifelse(y == 1, "class 2", "class 3"))

# create ouput using numbers from 1 to length(y) as metalabels
lcloud(mat, y, col.axis="black", col.lab="blue", col.bg="white",
htmlout="result.html")


# example 2: scaled parametric plot of a sphere
p <- seq(-pi,pi, length=30)
x <- c(rep(1, 30) %*% t(cos(p)))
y <- c(cos(p) %*% t(sin(p)))
z <- c(sin(p) %*% t(sin(p)))

lcloud(cbind(x,y,z), cols="blue", showaxis=FALSE)


# example 3: visualization of Edgar Anderson's Iris data
# using density estimation contour surfaces (requires misc3-package!)
irismat <- iris[,1:3]
lcloud(irismat, labels=iris[,5], col.bg="white", col.axis="blue",
col.lab="black", lab.axis=colnames(irismat))

Run the code above in your browser using DataLab