Learn R Programming

kmlShape (version 0.9.5)

plot: ~ Function: plot for Clds ~

Description

plot plot both the trajectories the the clusters' means of an object Clds.

Usage

"plot"(x,y,col="darkgrey",lty=1,legend=TRUE,...)

Arguments

x
[Clds]: Object containing the trajectories to plot.
y
Useless. For compatibility only.
col
[character], [integer] or [vector(integer)]: color use for the trajectories. If the special value "clusters" is used, the trajectories will be colored according to their clusters.
lty
[integer] or [vector(integer)]: line type of the trajectories
legend
[logical]: shall the pourcent of individual in each cluster be printed as a legend ?
...
Arguments to be passed to methods. These arguments need to be compatible with plotTraj.

Details

plot plot both the trajectories the the clusters' means of an object Clds. If the option col="clusters" is used, the trajectories will be colored according to their clusters.

Examples

Run this code

### Generating artificial data
nbLignes <- 12
trajH <- matrix(0,nbLignes,10)

 for(i in 1:(nbLignes/3)){
   trajH[i,] <- pnorm(1:10,runif(1,3,8),1)*rnorm(1,10,1)
}
for(i in (nbLignes/3+1):(2*nbLignes/3)){
   trajH[i,] <- dnorm(1:10,runif(1,3,8),1)*rnorm(1,13,1)
}

for(i in (2*nbLignes/3+1):nbLignes){
   trajH[i,] <- pnorm(1:10,runif(1,3,8),1)*rnorm(1,5,0.1)
}

myClds <- cldsWide(data.frame(1:60,trajH))

par(mfrow=c(1,2))
plotTraj(myClds)
kmlShape(myClds,toPlot="none")
plotTraj(myClds)

Run the code above in your browser using DataLab