plot: ~ Function: plot for ClusterLongData ~

plot,ClusterLongDataR Documentation

~ Function: plot for ClusterLongData ~

Description

plot the trajectories of an object ClusterLongData relatively to a Partition.

Usage

## S4 method for signature 'ClusterLongData,ANY'
plot(x,y=NA,parTraj=parTRAJ(),parMean=parMEAN(),
   addLegend=TRUE, adjustLegend=-0.12,toPlot="both",criterion=x["criterionActif"],
   nbCriterion=1000, ...)

Arguments

x

[ClusterLongData]: Object containing the trajectories to plot.

y

[numeric] or [vector(numeric)]: Give the Partition to represent. If y is missing, the Partition with the highest quality criterion (the actif one) is selected. If y is a number, the first Partition of the sublist c-y is selected. If y is a couple of numeric, the y[2]th Partition of the sublist c-y[1] is selected.

parTraj

[ParLongData]: Specification of the plotting parameters of the individual trajectories. Fields that can be changes are 'type','col','pch','xlab' and 'ylab'. In addition to the standard possible values, the option col="clusters" can be use to color the individual trajectories according to their clusters (exemple: parTraj=parTRAJ(type="o",col="clusters")). See ParLongData in package longitudinalData for details.

parMean

[ParLongData]: Specification of the plotting parameters of the mean trajectories. Fields that can be changes are 'type','col','pch','pchPeriod' and 'cex'. See ParLongData in package longitudinalData for details.

toPlot

[character]: either 'traj' for plotting trajectories alone, 'criterion' for plotting criterion alone, 'both' for plotting both or 'none' for not display anything (faster).

criterion

[character] or [vector(character)]: criterion to display (only if 'toPlot' is 'criterion' or 'both'). If a single criterion is given, it will be display for all the Partition. If several criterion are used, they will be display for the first Partition for each clusters' numbers.

nbCriterion

[numeric]: if a single criterion is given to criterion (and thus is displayed for 'all' the Partition), this slot alows to fix a limit on the number of points that will be display.

addLegend

[logical]: should the legend be displayed?

adjustLegend

[numeric]: fix the hight of the legend

...

Some other parameters can be passed to the method (like "xlab" or "ylab".

Details

plot the trajectories of an object ClusterLongData relativly to the 'best' Partition, or to the Partition define by y.

Graphical option concerning the individual trajectory (col, type, pch and xlab) can be change using parTraj. Graphical option concerning the cluster mean trajectory (col, type, pch, pchPeriod and cex) can be change using parMean. For more detail on parTraj and parMean, see object of class ParLongData in package longitudinalData.

See Also

Overview: kml-package
Classes : ClusterLongData
Plot : plot: overview, plotCriterion

Examples

### Move to tempdir
wd <- getwd()
setwd(tempdir()); getwd()

##################
### Construction of the data

ld <- gald()

### Basic plotting
plot(ld)


##################
### Changing graphical parameters 'par'

kml(ld,3:4,1)

### No letters on the mean trajectories
plot(ld,3,parMean=parMEAN(type="l"))

### Only one letter on the mean trajectories
plot(ld,4,parMean=parMEAN(pchPeriod=Inf))

### Color individual according to its clusters (col="clusters")
plot(ld,3,parTraj=parTRAJ(col="clusters"))

### Mean without individual
plot(ld,4,parTraj=parTRAJ(type="n"))


### No mean trajectories (type="n")
### Color individual according to its clusters (col="clusters")
plot(ld,3,parTraj=parTRAJ(col="clusters"),parMean=parMEAN(type="n"))

### Only few trajectories
plot(ld,4,nbSample=10,parTraj=parTRAJ(col='clusters'),parMean=parMEAN(type="n"))

### Go back to current dir
setwd(wd)

kml documentation built on Oct. 30, 2024, 9:09 a.m.