Learn R Programming

kml3d (version 2.3)

plot3d,ClusterLongData3d: ~ Function: plot3d for ClusterLongData3d ~

Description

Plot two variables of a ClusterLongData3d object in 3D, optionnaly relatively to a Partition.

Usage

## S3 method for class 'ClusterLongData3d,missing':
plot3d(x,y,varY=1,varZ=2,
   parTraj=parTRAJ(),parMean=parMEAN(),nbSample=200,...)
## S3 method for class 'ClusterLongData3d,numeric':
plot3d(x,y,varY=1,varZ=2,
   parTraj=parTRAJ(),parMean=parMEAN(),nbSample=200,...)

Arguments

x
[ClusterLongData3d]: Object containing the trajectories to plot.
y
[numeric] or [vector2(numeric)]: Define the Partition P that will be use to plot the object. P is a Partition hold in the field c2, c3, ... c26
varY
[numeric] or [character]: either the number or the name of the first variable to display. 1 by default.
varZ
[numeric] or [character]: either the number or the name of the second variable to display. 2 by default.
parTraj
[ParLongData]: Set the graphical parameters used to plot the trajectories of the ClusterLongData3d. See ParLongData for details.
parMean
[ParLongData]: Set the graphical parameters used to plot the mean trajectories of each clusters ClusterLongData3d (only when y is non missing). See ParLongData
nbSample
[numeric]: Graphical display of huge sample can be time consumming. This parameters fixe the maximum numbre of trajectories (randomly chosen) that will be drawn.
...
Arguments to be passed to methods, such as graphical parameters.

Details

Plot two variables of a ClusterLongData3d object in 3D. It use the rgl library. The user can make the graphical representation turn using its mouse.

See Also

ClusterLongData3d

Examples

Run this code
##################
### Real example on array

time=c(1,2,3,4,8,12,16,20)
id2=1:120
f <- function(id,t)((id-1)%%3-1) * t
g <- function(id,t)(id%%2+1)*t
h <- function(id,t)(id%%4-0.5)*(20-t)
myCld <- clusterLongData3d(array(cbind(outer(id2,time,f),outer(id2,time,g),
   outer(id2,time,h))+rnorm(120*8*3,0,3),dim=c(120,8,3)))
part <- partition(rep(1:6,20))

### Basic plot
plot(myCld,part)

### plot3d, variable 1 and 2
plot3d(myCld,part)

### plot3d, variable 1 and 3
plot3d(myCld,part,varZ=3)
plot3d(myCld,parTraj=parTRAJ(col="red"))

Run the code above in your browser using DataLab