do3d is a wrapper for scatterplot3d. do3d will draw a single 3D xyz
plot and will plot each group of points in a different colour, given a
factor.
rotate3d calls do3d to draw multiple 3D plots in which each plot is
marginally rotated on the x-y axis.
Usage
do3d(dataset, x = 1, y = 2, z = 3, angle = 40, classvec = NULL, classcol
= NULL, col = NULL, cex.lab=0.3, pch=19, cex.symbols=1, ...)
rotate3d(dataset, x = 1, y = 2, z = 3, beg = 180, end = 360, step = 12,
savefiles = FALSE, classvec = NULL, classcol = NULL, col = NULL, ...)
Arguments
dataset
XYZ coordinates to be plotted. A matrix or data.frame
with 3 or more columns. Usually results from multivariate analysis, such as the $co or $li coordinates
from a PCA dudi.pca, or COA
dudi.coa or the $ls, $co coordinates from
bga.
x
Numeric, the column number for the x-axis, the default is 1 (that is
dataset[,1])
y
Numeric, the column number for the y-axis, the default is 2 (that is dataset[,2])
z
Numeric, the column number for the z-axis, the default is 3 (that is dataset[,3])
angle
Numeric, the angle between x and y axis. Note the result depends
on scaling. See scatterplot3d
classvec
A factor or vector which describes the classes in dataset
classcol
A factor or vector which list the colours for each of the classes
in the dataset. By default NULL. When NULL, getcol is used to
obtain an optimum set of colours of the classes in classvec.
cex.lab
Numeric. The magnification to be used for the axis annotation
relative to the current default text and symbol size. Default is 0.3
pch
Integer specifying a symbol or single character to be used when
plotting points. The default is pch= 19
cex.symbols
Numeric. The magnification to be used for the symbols
relative to the current default text size. Default is 1
col
A character indicating a colour. To be used if all points
are to be one colour. If classvec, classcol and col are all
NULL. all points will be drawn in red by default.
beg
Numeric. The starting angle between the x and y axis for
rotate3d. Rotate3d will draw plots in which they are
rotated from angle beg to angle end
end
Numeric. The final angle between the x and y axis for
rotate3d. Rotate3d will draw plots in which they are
rotated from angle beg to angle end
step
Numeric. Increment of the sequence between the starting
angle beg and the final angle end.
savefiles
Logical, indicating whether the plot should be
saved as a pdf file. The default is FALSE
...
further arguments passed to or from other methods
Details
This calls scatterplot3d to plot a 3d representation of results.
It is also worth exploring the package rgl which enables dynamic 3d plot (that can be rotated)
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(made4)
Loading required package: ade4
Loading required package: RColorBrewer
Loading required package: gplots
Attaching package: 'gplots'
The following object is masked from 'package:stats':
lowess
Loading required package: scatterplot3d
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/made4/do3d.Rd_%03d_medium.png", width=480, height=480)
> ### Name: do3d
> ### Title: Generate 3D graph(s) using scatterplot3d
> ### Aliases: do3d rotate3d
> ### Keywords: hplot
>
> ### ** Examples
>
> data(khan)
> if (require(ade4, quiet = TRUE)) {
+ khan.coa<-dudi.coa(khan$train, scannf=FALSE, nf=5)
+ }
> par(mfrow=c(2,1))
> do3d(khan.coa$co, classvec=khan$train.classes)
> do3d(khan.coa$co, col="blue")
> rotate3d(khan.coa$co,classvec=khan$train.classes)
> khan.bga<-bga(khan$train, khan$train.classes)
> plot.new()
> par(bg="black")
> do3d(khan.bga$bet$ls, classvec=khan$train.classes)
>
>
>
>
>
> dev.off()
null device
1
>