plotDR: Plotting tool for two and three dimensional data

Description Usage Arguments Details Author(s) Examples

View source: R/plotDR.R

Description

Creates two and three dimensional plots of (labeled) data. It uses the library "rgl" for rotatable 3D scatterplots.

Usage

1
plotDR(data, labels, axesLabels=c("x","y","z"), legend=FALSE, text, col, pch, ...)

Arguments

data

matrix with values to be plotted (rows correspond to samples, columns to features)

labels

vector containing labels of the classes within the data (optional)

axesLabels

vector containing labels for the axes of the plot

legend

logical value whether to automatically insert a legend into the plot

text

vector with (short) labels for each point (optional)

col

character vector of colours for each class (optional); see colors() to display a list of available colours

pch

character or integer value specifying the symbol when plotting points (see ?par or ?points for more info)

...

other common R plot parameters like for example las, cex or font to further customize the plot (see ?par for possible arguments); some parameters may only work with two dimensional plots

Details

It colours the data points according to given class labels (max. six classes when using default colours). A legend will be printed in the R console by default (for three dimensional plots, a legend is not supported).

Author(s)

Christoph Bartenhagen

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## plot a two dimensional LLE embedding of a 1.000 dimensional dataset
d = generateData(samples=20, genes=1000, diffgenes=100, blocksize=10)
d_low = LLE(data=d[[1]], dim=2, k=5)
plotDR(data=d_low, labels=d[[2]])

## plot a two dimensional LLE embedding of a 1.000 dimensional dataset
## add axis labels, a legend and plot a text for each sample
d = generateData(samples=20, genes=1000, diffgenes=100, blocksize=10)
d_low = LLE(data=d[[1]], dim=2, k=5)
text = letters[1:20]
plotDR(data=d_low, labels=d[[2]], axesLabels=c("first component", "second component"), text=text, legend=TRUE)
## manually add a legend to the plot
plotDR(data=d_low, labels=d[[2]], axesLabels=c("first component", "second component"), text=text)
legend("topright", legend=c("class 1","class 2"), col=c("black", "red"), pch=1)

RDRToolbox documentation built on Nov. 8, 2020, 11:10 p.m.