plot.trajClusters: Plot 'trajClusters' object

View source: R/plot.trajClusters.R

plot.trajClustersR Documentation

Plot trajClusters object

Description

Plots the curves corresponding to (or closest to) the centroids of the clusters and plots a random sample from each groups.

Usage

## S3 method for class 'trajClusters'
plot(x, sample.size = 5, ask = TRUE, which.plots = NULL, ...)

scatterplots(x, ask = TRUE, which.scatter = NULL, N = NULL, ...)

CVIplot(x, ...)

Arguments

x

object of class trajClusters as returned by the function trajClusters().

sample.size

the number of trajectories to be randomly sampled from each clusters. If NULL, all the trajectories are included in a random order. Defaults to 5.

ask

logical. If TRUE, the user is asked before each plot. Defaults to TRUE.

which.plots

either NULL or a vector of integers. If NULL, every available plot is displayed. If a vector is supplied, only the corresponding plots will be displayed.

...

other parameters to be passed through to plotting functions.

which.scatter

either NULL or a vector of integers that is a subset of the measure argument used in function trajClusters to produce object x. If NULL, every available scatter plots are displayed. If a vector is supplied, only the corresponding plots will be displayed.

N

the maximum number of points present in each scatter plots. If a non NULL value is specified, N points are sampled randomly in a way that preserves the relative groups sizes. If NULL (the default), all the points are plotted.

Examples

## Not run: 
data("trajdata")
trajdata.noGrp <- trajdata[, -which(colnames(trajdata) == "Group")] #remove the Group column

m = trajMeasures(trajdata.noGrp, ID = TRUE)
c3 = trajClusters(m, nclusters = 3)

plot(c3)

#The pointwise mean trajectories correspond to the third and fourth displayed plots.

c4 = trajClusters(m, nclusters = 4)

plot(c4, which.plots = 3:4)


## End(Not run)



traj documentation built on March 16, 2026, 1:06 a.m.