plotAlluvial: Plot Alluvial

Description Usage Arguments Value Author(s) See Also Examples

View source: R/plotAlluvial.R

Description

This function plots an alluvial (Parallel coordinate plot) of sample clusterings for a specified number of clusters. Samples can be coloured by providing a vector of colours, allowing for the visualization of sample properties over a range of clustering number choices.

*This is a wrapper function calling the Alluvial Package (Bojanowski M. & Edwards R)

Usage

1
plotAlluvial(W, clust.range, color.vect)

Arguments

W

Affinity matrix of dimension n.samples by n.samples

clust.range

Integer vector specifying the number of clusters for each clustering

color.vect

A vector of color's of length n.samples to colour the samples

Value

Plots an alluvial plot for range of clustering choices.

Author(s)

Daniel Cole

See Also

More information on Alluvial Package

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
K <- 20
alpha <- 0.5
iter <- 20

data(Data1)
data(Data2)

dist1 <- (dist2(as.matrix(Data1), as.matrix(Data1)))^(1/2)
dist2 <- (dist2(as.matrix(Data2), as.matrix(Data2)))^(1/2)

W1 <- affinityMatrix(dist1, K, alpha)
W2 <- affinityMatrix(dist2, K, alpha)

W <- SNF(list(W1, W2), K, iter)

#Plots the alluvial with no colouring
plotAlluvial(W, 2:5)

#Change the colour of all samples a single colour
plotAlluvial(W, 2:5, col="red")

colour.breaks <- 30
#This will assign each sample to one of colour.breaks colour bins between green and red.
colFunc <- colorRampPalette(c("green", "red"))
colours <- colFunc(colour.breaks)[as.numeric(cut(Data1[,1],breaks=colour.breaks))]
plotAlluvial(W, 2:5, col=colours)

Example output



SNFtool documentation built on June 11, 2021, 9:06 a.m.