Learn R Programming

Starr (version 1.28.0)

profileplot: Vizualize clusters

Description

Visualization of a set of ``profiles'' (i.e. a consecutive series of measurements like a time series, or the DNA binding levels along different positions on a gene). The profiles are given as the rows of a (samples x positions) matrix that contains the measurements. Instead of plotting a line for each profile (row of the matrix), the q-quantiles for each position (column of the matrix) are calculated, where q runs through a set of representative quantiles. Then for each q, a line of q-quantiles is plotted along the positions. Color coding of the quantile profiles aids the interpretation of the plot: There is a color gradient from the median profile to the 0 (=min) resp. 1(=max) quantile.

Usage

profileplot(cluster, label=NULL, at=NULL, main = "", xlim=NULL, xlab = "", xaxt = "s",xlabels = NULL, las = 1, ylim=NULL, ylab = "", fromto = c(0.05,0.95),colpal = "heat", nrcolors = 25, outer.col="light grey", add.quartiles = T, add = F, separate = T)

Arguments

cluster
a (samples x columns) matrix with numerical entries. Each sample row is understood as a consecutive series of measurements. Missing values are not allowed so far
label
if multiple clusters should be plotted in one diagram, the cluster labels for each item are given in this vector
at
optional vector of length ncol(cluster), default = 1:ncol(cluster). Specifies the x-values at which the positions will be plotted.
main
the title of the plot, standard graphics parameter
xlim
xlimits, standard graphics parameter
xlab
x-axis legend, standard graphics parameter
xaxt
should an x axis be plotted at all? (="n" if not), standard graphics parameter
xlabels
character vector. If specified, this text will be added at the ``at``-positions as x-axis labels.
las
direction of the xlabels text. las=1: horizontal text, las=2: vertical text
ylim
ylimits, standard graphics parameter
ylab
y-axis legend, standard graphics parameter
fromto
determines the smallest and the largest quantile that are plotted in colors, more distant values are plotted as outliers
colpal
either "red","green","blue" (predefined standard color palettes in profileplot), or a vector of colors to be used instead.
nrcolors
not very important. How many colors will the color palette contain? Usually, the default = 25 is sufficient
outer.col
color of the outlier lines, default = "light grey". For no outliers, choose outer.col="none"
add.quartiles
should the quartile lines be plotted (grey/black)? default=TRUE
add
should the profile plot be added to the current plot? Defaults to FALSE
separate
should each cluster, be plotted in a separate window? Defaults to TRUE

Examples

Run this code
sampls = 100
probes = 63
at = (-31:31)*14
clus = matrix(rnorm(probes*sampls,sd=1),ncol=probes)
clus= rbind( t(t(clus)+sin(1:probes/10))+1:nrow(clus)/sampls , t(t(clus)+sin(pi/2+1:probes/10))+1:nrow(clus)/sampls )
labs = paste("cluster",kmeans(clus,4)$cluster)

profileplot(clus,main="All data",fromto=c(0,1))
profileplot(clus,label=labs,main="Clustered data",colpal=c("heat","blue","red","topo"),add.quartiles=FALSE)
profileplot(clus,main="Same data, 4 clusters in one plot\n color gradient fromto = c(0.4,0.6), no outliers plotted",label=labs,separate=FALSE,xaxt="n",fromto=c(0.4,0.6),
	colpal=c("heat","blue","red","green"),outer.col="none")

Run the code above in your browser using DataLab