plot.trajClusters: Plot 'trajClusters' object

View source: R/plot.trajClusters.R

plot.trajClustersR Documentation

Plot trajClusters object

Description

plot() sequentially plots (i) the clusters centroids, (ii) a random sample of trajectories from each cluster, and (iii) the median of each standardized measure by cluster. (scatterplots() displays the two dimensional projections of the standardized data in feature space for every pair of measures. CVIplot() graphs the internal cluster validity indices as a function of the number of clusters as well as the result of the ranked voting system for determining the optimal number of clusters.

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 the 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, which.plots = 1, ask= FALSE) ## centroids

plot(c3, which.plots = 2, ask= FALSE) ## sample trajectories

plot(c3, which.plots = 3, ask= FALSE) ## median of standardized measures by cluster

## End(Not run)



traj documentation built on Sept. 9, 2026, 1:07 a.m.